Log in

View Full Version : PHP string function



devil_vin
09-25-2007, 03:00 PM
Hi..guys!What is the string function that cut 01,02,03 to 1,2,3?Thanks...

boogyman
09-25-2007, 03:06 PM
str_replace('0', '', $string);

that would replace all zero's though not just the leading zero's

devil_vin
09-25-2007, 03:26 PM
Problem resolved,thanks..my string only has a zero in leading position.

djr33
09-26-2007, 02:12 AM
More thorough:
<?php
$string = explode(',',$string);
foreach ($string as $k=>$v) {
$string[$k] = ($v+1)-1;
}
//$string is now fixed
?>