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 = 'support@';
$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
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments