Re: Re: strtr array replace issue...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




Brad Freshour wrote:
> Keith, thanks... no luck doing it that way either... Can someone else
> try the snippet and see what is returned?
>
> php > $a = "/home/user/public_html/Packages/temp";
> php > $b = array('' => '');
> php > echo strtr($a, $b);
> php > echo $a;
> /home/user/public_html/Packages/temp
> php > print_r($b);
> Array
> (
>     [] =>
> )

PHP 4.3.9, 5.2 and 5.3 all do the same.  Note the return value from
phptr() is false (try var_dump instead of print_r)

You can debug what PHP is doing by breaking on php_strtr_array() in
ext/standard/standard.c.  If a zero length key is seen, it returns
false.

As to expected behavior: feel free to log a bug, but be prepared to
defend your reasoning.

Chris

--
Email: christopher.jones@xxxxxxxxxx  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrd    Free PHP Book: http://tinyurl.com/UGPOM

[Index of Archives]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [Postgresql]     [PHP Books]     [PHP Databases]     [PHP SOAP]
  Powered by Linux