Re: [PHP-INSTALL] Re: strtr array replace issue...

[email protected] (Christopher Jones)
Newsgroups php.install
Message-ID <[email protected]>
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: [email protected]  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrd    Free PHP Book: http://tinyurl.com/UGPOM
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.