Remove first 4 characters of a string with PHP

Belgin Fish picture Belgin Fish · Nov 26, 2010 · Viewed 310.7k times · Source

How can I remove the first 4 characters of a string using PHP?

Answer

Daniel Vandersluis picture Daniel Vandersluis · Nov 26, 2010

You could use the substr function to return a substring starting from the 5th character:

$str = "The quick brown fox jumps over the lazy dog."
$str2 = substr($str, 4); // "quick brown fox jumps over the lazy dog."