note 22112 added to function.array-splice
| From: | paule at cs dot tamu dot edu | Date: | Fri, 07 Jun 2002 03:09:17 +0000 |
| Subject: | note 22112 added to function.array-splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31549@lists.php.net to get a copy of this message | ||
After reading KoKos' post above, I thought that the code I posted right before his should do
what he wanted. However, my original post neglected to note the little "Tip" in the
documentation above, about a single element replacement.
If one changes the lines in my code above that says:
if(is_array($replacement))
foreach($replacement as $r_key=>$r_value)
$new_array[$r_key]=$r_value;
to instead say:
if(is_string($replacement))
$new_array[$key]=$replacement;
elseif(is_array($replacement))
foreach($replacement as $r_key=>$r_value)
$new_array[$r_key]=$r_value;
that will solve the problem.
Sorry for the omission.
--
http://www.php.net/manual/en/function.array-splice.php
http://master.php.net/manage/user-notes.php?action=edit+22112
http://master.php.net/manage/user-notes.php?action=delete+22112
http://master.php.net/manage/user-notes.php?action=reject+22112