Req #64854 [NEW]: array_key_exists( array('key1', 'key2', 'key3'), $array);
| From: | bensor987 at neuf dot fr | Date: | Thu, 16 May 2013 07:44:48 +0000 |
| Subject: | Req #64854 [NEW]: array_key_exists( array('key1', 'key2', 'key3'), $array); | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-178959@lists.php.net to get a copy of this message | ||
From: bensor987 at neuf dot fr
Operating system: All
PHP version: Irrelevant
Package: Arrays related
Bug Type: Feature/Change Request
Bug description:array_key_exists( array('key1', 'key2', 'key3'),
$array);
Description:
------------
Why can't we give an array as the first parameter of array_key_exists() ? I
have a few cases where it would be useful. Especially when checking $_POST,
$_GET or $_REQUEST arrays (for instance).
Test script:
---------------
$array_to_test = array( 'key1' => 1, 'key2' => 1, 'key3' => 1
);
$array_keys = array( 'key1', 'key2', 'key3');
var_dump( array_key_exists( $array_keys, $array_to_test ) );
var_dump( (array_key_exists( 'key1', $array_to_test ) && array_key_exists(
'key2', $array_to_test ) && array_key_exists( 'key3', $array_to_test ))
);// The same as above, but much longer.
Expected result:
----------------
bool(true) bool(true)
Actual result:
--------------
bool(false) bool(true)
--
Edit bug report at https://bugs.php.net/bug.php?id=64854&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64854&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64854&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64854&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64854&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64854&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64854&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64854&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64854&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64854&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64854&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64854&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64854&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64854&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64854&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64854&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64854&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64854&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64854&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64854&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64854&r=mysqlcfg