Question #6094   Submitted by Answiki on 04/19/2022 at 08:14:58 PM UTC

How to remove the first character of a string in PHP?

Answer   Submitted by Answiki on 04/19/2022 at 08:16:25 PM UTC

In PHP, the substr() function is the best way to delete the first characters of a string:

// Delete the first character of $string
$string = substr($string, 1);

// The following example displays bcdef :
echo substr('abcdef', 1);




2 events in history
Answer by Answiki on 04/19/2022 at 08:16:25 PM

In PHP, the substr() function is the best way to delete the first characters of a string:

// Delete the first character of $string
$string = substr($string, 1);

// The following example displays bcdef :
echo substr('abcdef', 1);




Question by Answiki 04/19/2022 at 08:14:58 PM
How to remove the first character of a string in PHP?
# ID Query URL Count

Icons proudly provided by Friconix.