Answers for "php replace string with array values"

PHP
0

php replace string with array values

$string = "last_name, first_name";
$search = array('first_name', 'last_name');
$replace = array('John', 'Smith');

$result = str_replace($search, $replace, $string);
Posted by: Guest on June-15-2021

Code answers related to "php replace string with array values"

Browse Popular Code Answers by Language