|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-11-01 01:34 UTC] jonimane at gmail dot com
Description:
------------
Can you implements overload methods?
look test script x.x
my english is so so bad, sorry.
if you didn't understand me, i can explain you x.x
thx
Test script:
---------------
<?php
class Test
{
public function hello()
{
echo "hello";
}
public function hello($name)
{
echo "hello {$name}";
}
}
$c = new Test;
$c->hello(); // print "hello"
$c->hello("PHP"); // print "hello PHP"
?>
Expected result:
----------------
don't give errors and method overload work
Actual result:
--------------
Fatal error: Cannot redeclare Test::hello() in C:\...\Test.php on line 9
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 19:00:01 2025 UTC |
hm =/ To polymorphism would greatly help function t(Test $t) { ... } function t(NoTest $t) { ... } so, thank you anyway =] if it were implemented would be great *-* thx again =]