If I have a string
00020300504
00000234892839
000239074
how can I get rid of the leading zeroes so that I will only have this
I don't think preg_replace is the answer.. old thread but just happen to looking for this today. ltrim and (int) casting is the winner.
";
echo $fixed_str1 . " Fix1";
echo "
";
echo $fixed_str2 . " Fix2";
echo "
";
echo $fixed_str3 . " Fix3";
echo "
";
echo $actualInt . " Actual integer in string";
//output
0000001123000 Origina
1123 Fix1
1123000 Fix2
1123000 Fix3
1123000 Actual integer in tring