Reputation: 1
I have this string:
mr (3_22)
I want php to output that string to:
(3_22)
How can i do that with PHP? I need a sample code please
Upvotes: 0
Views: 38
Reputation: 4237
Try the following code:
$str ='mr (3_22) mrs (1_12) miss (2_4)';
$re ='';
if(preg_match_all('/(\([^\)]+\))/i', $str, $mt)){
$re = implode('', $mt[0]);
}
echo $re; // (3_22)(1_12)(2_4)
Upvotes: 1