I had a need the other day to remove a char from the beginning of a string in PHP. Rather than fiddle around with the existing function substr(), I whipped up my own function that will remove X number of characters from the beginning of a string.
function removeXnumCharFromFront($instring,$x)
{
$length = strlen($instring);
for($i=$x; $i<$length; $i++) $temp[] = $instring[$i];
$comma_separated = implode(",", $temp);
$outstring = eregi_replace(",","",$comma_separated);
return $outstring;
}
Enjoy!