|
Posted by jmark on 08/12/07 19:45
I saw this example in php.net
// Outputs: apearpearle pear
$letters = array('a', 'p');
$fruit = array('apple', 'pear');
$text = 'a p';
$output = str_replace($letters, $fruit, $text);
echo $output;
and I am bit puzzled why the output is the way it is instead of
apple pear
it looks like str_replace is replacing the p in apple to pear but why
does not replace the p in pear to pear and the a to apple and why is
the output not "apple pear"?
Thanks
John
Navigation:
[Reply to this message]
|