string function in PHP will remove whitespace and characters from the front of a string. You can pass up to 2 parameters through it. First parameter is the target string. The second parameter is optional and is any specified character(or substring) you want removed from the front of a string.
With only one paramter used this function will remove a space, tab, new line, carriage return, NUL-byte, and vertical tab characters from the beginning of a string.
You can specify a range of characters to trim such as (a..z), or type the exact characters you want stripped as in the example below.
$myString = "I wish to remove 'I wish' and any whitespace.";
echo "<br />";
$newString = ltrim($myString, "I wish"); // Trims the leading chars expected
I wish to remove 'I wish' and any whitespace.
to remove 'I wish' and any whitespace.