Jump to content

Combining multiple preg_replaces ..?


DamienRoche

Recommended Posts

Hi. I am just wondering if I can combine multiple preg_replaces.

 

For example:

 

<?php

$str = "this is a string 123 ABC";
$var = "this is a";

$newstr = preg_replace("#[A-Z]#", "", $str);
$newstr = preg_replace("#$var#", "", $str);

?>

 

 

Is there a way to combine the $var and the character set?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/129035-combining-multiple-preg_replaces/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.