I want to replace with preg_replace with one line.
here’s the php file.
<?php
$var_name = 'Firstname Lastname <[email protected]>';
$var_name = preg_replace('/</', '(', $var_name);
$var_name = preg_replace('/>/', ')', $var_name);
echo 'OUTPUT: ' . $var_name . "n";
?>
I get the expected OUTPUT as
OUTPUT: Firstname Lastname ([email protected])
But, I want to get it with one preg_replace line?
Hope to hear from you.
Source: Ask PHP