#43766 [Opn->Bgs]: Arrays and inverted commas

From: Date: Mon, 07 Jan 2008 14:57:15 +0000
Subject: #43766 [Opn->Bgs]: Arrays and inverted commas
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121105@lists.php.net to get a copy of this message
ID: 43766 Updated by: iliaa@php.net Reported By: quick dot webmaster at gmail dot com -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Linux PHP Version: 5.2.5 New Comment: see above comment. Previous Comments: ------------------------------------------------------------------------ [2008-01-06 11:41:53] felipe@php.net Your code is wrong, it is attempt to pass array as first argument. I'm using PHP5.3, and the code below works fine. So, try: <?php $image = '<img src="http://bugs.php.net/gifs/logo-bug.gif" />'; $trans4 = array('<img src="' => '', '" />' => ''); var_dump(strtr($image, $trans4)); // string(37) "http://bugs.php.net/gifs/logo-bug.gif" ?> ------------------------------------------------------------------------ [2008-01-06 06:38:13] quick dot webmaster at gmail dot com Description: ------------ Hello, if you try to insert a " immediately before a ' in an array then it will return strange results results. Reproduce code: --------------- <?php $image[0] = array('<img src="http://bugs.php.net/gifs/logo-bug.gif" />'); $trans4 = array('<img src="' => '', '" />' => ''); $image2 = strtr($image[0], $trans4); ?> Expected result: ---------------- http://bugs.php.net/gifs/logo-bug.gif Actual result: -------------- http://bugs.php.net/gifs/logo-bug.gif" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43766&edit=1

« previous php.bugs (#121105) next »