#23239 [Opn]: preg_replace don(t work on multi-dimensional arrays

From: Date: Wed, 30 Apr 2003 08:58:56 +0000
Subject: #23239 [Opn]: preg_replace don(t work on multi-dimensional arrays
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38790@lists.php.net to get a copy of this message
ID: 23239 Updated by: derick@php.net Reported By: bibifoc23 at yahoo dot fr Status: Open -Bug Type: Arrays related +Bug Type: Feature/Change Request Operating System: windows & linux PHP Version: php-4.3.2-RC2 New Comment: it's still not a bug but a feature request. Previous Comments: ------------------------------------------------------------------------ [2003-04-30 03:54:38] bibifoc23 at yahoo dot fr always the problem with preg_replace with multi-dimensional array with php-4.3.2 ------------------------------------------------------------------------ [2003-04-16 07:58:48] bibifoc23 at yahoo dot fr when i use p_reg_replace on multi-dimensional arrays, the utput array is one dimensional array and so i lost data. i get this bug when i want replace patten with a ldap result (ldap_get_entries); i use the latest win32 CVS (php4) and i get with php-4.2.3 <?php # good result $tableau = array ( "toto", "titi", "tata" ); $tableau2 = preg_replace ( '{t}', '-', $tableau ); var_dump ( $tableau2 ); echo "----------------------------------------------\n"; # wrong result $tableau = array ( array ("toto"), array ("titi"), array ("tata") ); var_dump ( $tableau ); $tableau2 = preg_replace ( '{t}', '-', $tableau ); var_dump ( $tableau2 ); ?> the output is: array(3) { [0]=> string(4) "-o-o" [1]=> string(4) "-i-i" [2]=> string(4) "-a-a" } --------------------------------------------- array(3) { [0]=> array(1) { [0]=> string(4) "toto" } [1]=> array(1) { [0]=> string(4) "titi" } [2]=> array(1) { [0]=> string(4) "tata" } } array(3) { [0]=> string(5) "Array" [1]=> string(5) "Array" [2]=> string(5) "Array" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23239&edit=1

« previous php.bugs (#38790) next »