I want to take out GP123 (a string consisting of digits and characters in any order) from a bigger string ($str) and exclude Hello ($str1) which will be a string in another variable. My code is this. But it is not working. How can I remove a part of a string.
$str=" HelloGP123";
$str1="Hello";
preg_match_all("/(?:$str1)\w+\d+\w+/",$str,$str2);
print_r($str2);