|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-02-18 11:45 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2012-02-18 11:45 UTC] nikic@php.net
[2012-02-22 06:44 UTC] cornelius dot howl at gmail dot com
[2012-02-22 07:10 UTC] rasmus@php.net
[2012-02-22 07:10 UTC] rasmus@php.net
-Type: Bug
+Type: Feature/Change Request
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 14:00:02 2025 UTC |
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