脚本宝典收集整理的这篇文章主要介绍了PHP – 使用不同数量的参数覆盖函数,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
不幸的是我收到了PHP警告.
我的最小可验证示例:
http://pastebin.com/6MqUX9Ui
<?PHP class First { public function something($param1) { return 'first-'.$param1; } } class second extends first { public function something($param1,$param2) { return 'second params=('.$param1.','.$param2.')'; } } // Strict standards: Declaration of second::something() should be compatible wITh that of first::something() in /home/szymon/webs/wildcard/www/source/public/override.PHP on line 13 $myClass = new Second(); var_dump( $myClass->something(123,456) );
class Parent { PRotected function test($VAR1) { echo($var1); } } class Child extends Parent { protected function test($var1,$var2 = null) { echo($var1); echo($var1); } }
有关更多详细信息,请查看链接:http://php.net/manual/en/language.oop5.abstract.php
以上是脚本宝典为你收集整理的PHP – 使用不同数量的参数覆盖函数全部内容,希望文章能够帮你解决PHP – 使用不同数量的参数覆盖函数所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。