PREG_SET_ORDER lost effect inside a function ??

From: Date: Sat, 11 Nov 2000 04:19:25 +0000
Subject: PREG_SET_ORDER lost effect inside a function ??
Groups: php.general 
Request: Send a blank email to php-general+get-24757@lists.php.net to get a copy of this message
Hi regex experts, I was puzzled by the PREG_SET_ORDER behavior inside a function. This option of preg_match_all worked fine outside a function. For example, I've a string ($str) containing several books details such as title, author, price, and so on. Outside of a function: preg_match_all('/pattern/isU',$str,$matched_arr, PREG_SET_ORDER); would give the following result: matched_arr[0][1] = title 1 matched_arr[0][2] = author 1 matched_arr[0][3] = price 1 . matched_arr[1][1] = title 2 matched_arr[1][2] = author 2 matched_arr[1][3] = price 2 . . This is what I expected. However, when I did the preg_match_all with the same order option inside a function, it would give me: matched_arr[0][1] = title 1 matched_arr[0][2] = title 2 . . matched_arr[1][1] = author 1 matched_arr[1][2] = author 2 . . matched_arr[2][1] = price 1 matched_arr[2][2] = price 2 . . I did the test under win98 and php3.0.17. Any hints will be highly appreciated. Wingo Chan PHP & Regex newbie

« previous php.general (#24757) next »