Is there a way to limit exactly what ltrim removes in PHP.
I had a the following outcome:
$str = \"axxMyString\";
$newStr = ltrim($str, \"ax\");
// resu
If you know that the first two characters should be stripped, use:
$str = substr($str, 2);
ltrim($str, $chars)
removes every occurence from $chars
from the left side of the string.
If you only want to strip the first two characters when these equals ax
, you would use:
if (substr($str, 0, 2) == 'ax') $str = substr($str, 2);