Re: Bug 23654: str_replace doesn't handle multidimensional arrays
| From: | Moriyoshi Koizumi | Date: | Fri, 16 May 2003 18:22:56 +0000 |
| Subject: | Re: Bug 23654: str_replace doesn't handle multidimensional arrays | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1597@lists.php.net to get a copy of this message | ||
<pollita@php.net> wrote:
> > > I've got fixes for str_replace to let it handle multidimensional arrays,
> but
> > > I'm not sure if it should be applied to the 4.3 branch or not.
> > >
> > What is your fix like? Actually the current behaviour is ugly, but I don't
> > see the idea str_replace() should always be able to handle multi-dim
> > arrays as not all the users want it to do so. At most we'd be better off
> > if nested arrays were ignored.
> >
> That may be the better way to go. The fix I've got will traverse down the
> array reentrantly, but it's occured to me that it'll choke on a recursive
> array structure (i.e.: $array[] = &$array; ) That's fixable too of
> course, but it starts to get progressively ugly. Simply patching in this
> should do what you describe and keep everyone happy without making a
> significant change in branch. Maybe 5.0 can include an option to traverse
> down, maybe not...
Recursive arrays can be ignored because it is by no means a desired
behaviour IMO.
Anyway do we have to introduce str_replace_recursive() in 5.0 ? :) or most
likely the fifth argument?
Moriyoshi