String useless character strip - PHP

Posted by Zoltan Repas on Stack Overflow See other posts from Stack Overflow or by Zoltan Repas
Published on 2010-03-15T16:38:46Z Indexed on 2010/03/15 16:39 UTC
Read the original article Hit count: 230

Hi!

I've got a huge problem. I made a special ID for the things in our webpage. Let's see an example:

H0059 - this is the special ID called registration number. The last two chars are the things' id.

I'd like to cut off the useless characters, to get the real ID, what means strip the first char, and all the 0s before any other numbers.

(Example: L0745 => 745, V1754 => 1754, L0003 => 3, B0141 => 141, P0040 => 40, V8000 => 8000)

Please help me in this.

I've tried with strreplace and explode but failed :( Thanks for the help.

© Stack Overflow or respective owner

Related posts about php

Related posts about string-manipulation