note 77004 added to function.str-replace
| From: | (info@sima.cat) | Date: | Thu, 09 Aug 2007 19:22:53 +0000 |
| Subject: | note 77004 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129384@lists.php.net to get a copy of this message | ||
With PHP 4.3.1, at least, str_replace works fine when working with single arrays but mess it all
with two or more dimension arrays.
<?php
$subject = array("You should eat this","this","and this every day.");
$search = "this";
$replace = "that";
$new = str_replace($search, $replace, $subject);
print_r($new); // Array ( [0] => You should eat that [1] => that [2] => and that every day.
)
echo "<hr />";
$subject = array(array("first", "You should eat this")
,array("second","this")
,array("third", "and this every day."));
$search = "this";
$replace = "that";
$new = str_replace($search, $replace, $subject);
print_r($new); // Array ( [0] => Array [1] => Array [2] => Array )
?>
----
Server IP: 130.206.1.5
Probable Submitter: 84.77.247.241
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/77004
Del: integrated -- https://master.php.net/note/delete/77004/integrated
Del: useless -- https://master.php.net/note/delete/77004/useless
Del: bad code -- https://master.php.net/note/delete/77004/bad+code
Del: spam -- https://master.php.net/note/delete/77004/spam
Del: non-english -- https://master.php.net/note/delete/77004/non-english
Del: in docs -- https://master.php.net/note/delete/77004/in+docs
Del: other reasons-- https://master.php.net/note/delete/77004
Reject -- https://master.php.net/note/reject/77004
Search -- https://master.php.net/manage/user-notes.php