I have a string that looks like "123" and I want to use preg_replace to turn it into "123".
I have tried:
$test = "123"; preg_replace("//","",$test); and preg_replace("/^/","",$test);
Neither do anything. Any suggestions? Thanks!
Well, this is brute force.
if ($value[0] == '') { $value[0] = ' '; trim($value); }
This works fine for me.
$result = preg_replace("/^/","",$test);
Thanks mtmosier! I forgot that I had to assign the result of preg_replace to something and that it did not modify the string.