It does not appear to be in the documentation yet (and only a little
blurb in the NEWS file)
but preg_grep has changed.


Assume $file_list is an array of file names using integer keys, e.g.,
$file_list { 0 => "test", 1 => "filenames" }
$result = preg_grep("/name/i", $file_list);

Here is an example of what used to work:
print_r($result) would print $result { 0 => "filenames" }
So you could use $result[0] to get the value "filenames".

They way it works now:
print_r($result) prints $result { 1 => "filenames" }
So you have to search $result for array_keys and then use the result of
that on
the original array.
$keys = array_keys($result);
and use $file_list[$keys[0]] to get the value "filenames"
-or- create a for loop over $result -or- have the prescience to know the
right key
in $file_list to start with ;-)

Is this documented somewhere? The current PHP manual on php.net & zend
does
not reflect this change. The change broke my script when I upgraded from
4.0.1...
to 4.0.4+

Documentation could well be the achilles heel of open source.

-A



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to