I'm trying to replace only the first character of a string, but it isn't working, it replaces all the "0" on the string, here's my code:
$mes2 = str_replace('0', '', $mes[0]);
I want to replace the first character only if its a 0, example:
07 becomes 7
I don't want to replace all the time, example:
11 becomes 1, i don't want it.
I also tried this way, but it didn't work the way i want, because it's replacing also the second character if it's 0, like 10 becomes 1.
$mes2 = preg_replace('/0/', '', $mes, 1);