|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-06-13 23:44 UTC] iliaa@php.net
[2005-06-13 23:48 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 02:00:01 2025 UTC |
Description: ------------ When using type-hinting in a function's arguments, PHP should allow a default value of NULL. Otherwise you have to manaully check the type with instanceof. This would make it more convenient, and more consistent with Java. Reproduce code: --------------- function f (MyClass $o = NULL) { echo "success"; } f(); Expected result: ---------------- success Actual result: -------------- PHP compiler error.