str_replace using one array
Posted: Sat Oct 04, 2008 10:31 am
is there anyway to use str_replace using one array like this?
$key should be the key of $myarray
$value should be the value of $myarray
is there anyway to do this? because it's trouble some using seperate array for this case
Code: Select all
$myarray = array( "1" => "one", "2" => "two");
$string = "1 2";
echo str_replace($key, $value, $string);
$value should be the value of $myarray
is there anyway to do this? because it's trouble some using seperate array for this case