From:
Operating system: Any
PHP version: 5.4.0RC7
Package: *General Issues
Bug Type: Bug
Bug description:associative array syntax
Description:
------------
When using undefined $args['method'] this should not throw an error,
instead, it
should return undef or null.
In Perl or Ruby, Python, we usually write:
$value = $hash{key} || 'default value';
But in PHP, we have to write such code, that's such inefficient:
$value = isset($hash['key']) ? $hash['key'] : 'default';
Yes, we can use '@', but the '@' makes PHP runs more slower.
It will be better if we can have the following syntax:
$value = $hash['key'] || 'default value';
so that if you have multiple hashes:
$value = $hash['key'] || $hash2['key'] || $hash3['key'] || 'last
value';
then we don't have to write:
$value = isset($hash['key']) ? $hash['key'] : isset($hash2['key']) ?
$hash2['key'] : $hash2['key'] ........ # whatever
Thanks
--
Edit bug report at https://bugs.php.net/bug.php?id=61126&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61126&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61126&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61126&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61126&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61126&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61126&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61126&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61126&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61126&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61126&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61126&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61126&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61126&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61126&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61126&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61126&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61126&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61126&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61126&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61126&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61126&r=mysqlcfg