$srt=HDD(2GB*2)qty3##HDD(4GB*2)qty4##HDD(2GB*2)qty5
In above example i need to replace qty+next numeric value with null
The simplest way for such case is using preg_replace
function:
$srt= "HDD(2GB*2)qty3##HDD(4GB*2)qty4##HDD(2GB*2)qty5";
$srt = preg_replace("/qty\d+?/", "", $srt);
print_r($srt); // "HDD(2GB*2)##HDD(4GB*2)##HDD(2GB*2)"
For additional condition: 'replace qty3## like all with " ,"'
...
$srt = preg_replace("/qty\d+?##/", " ,", $srt);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments