How to remove a string from the beginning of a string

I will share with you how to delete a string from the beginning of a list. Method substr() extracts parts of a string starting at the given position and returns the specified number of characters.

<?php
$sub_string = '[email protected]';
$str = '[email protected]';
if (substr($str, 0, strlen($sub_string)) == $sub_string) 
{
 $str = substr($str, strlen($sub_string));
}
echo $str."\n";
?>
// output
w3-html.com

Leave a Reply

Your email address will not be published. Required fields are marked *