From: Xuefer at 21cn dot com
Operating system: all
PHP version: 4.3.4
PHP Bug Type: Feature/Change Request
Bug description: 2nd param for array_values
Description:
------------
old:
Usage: array array_values ( array input )
Purpose: Return all the values of an array
new suggestion:
Usage: array array_values ( array input, [mixed key] )
Purpose: Return all the values of an array
key default to null, which is same as old array_values
if key is_int or is_string
it act like this:
function array_values($input, $key)
{
$ret = array();
foreach ($input as $value) {
$ret[] = $value[$key];
}
return $ret;
}
this is very useful to collect ids
e.g.:
$idrows = db_query_all_rows("select id from table1");
$ids = implode(',', array_values($idrows, 'id'));
$myrows = db_query_all_rows("select .... from table2 where id IN($ids)");
(db_query_all_rows is custom function which fetch all rows of query
result)
thanks
--
Edit bug report at http://bugs.php.net/?id=26338&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26338&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26338&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26338&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26338&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26338&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=26338&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26338&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26338&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26338&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26338&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26338&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26338&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26338&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26338&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26338&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26338&r=float