0

How do I remove characters till there comes another character in a string?

For example:

String is this: 0030051

Now I want to remove ALL 0's before another character (like: 1) comes. So the string will become this: 30051.

Is there a PHP function for this or is this easier with Javascript/jQuery ? (I'd prefer PHP)

MikaldL
  • 159
  • 1
  • 2
  • 15

1 Answers1

3

cast it to integer

$var = (int)$var;

Source - Reference

Community
  • 1
  • 1
Sunil Silumala
  • 917
  • 5
  • 22