Edit report at http://bugs.php.net/bug.php?id=53215&edit=1
ID: 53215
User updated by: jonimane at gmail dot com
Reported by: jonimane at gmail dot com
Summary: Method overload on PHP
Status: Bogus
Type: Feature/Change Request
Package: Class/Object related
Operating System: Windows XP
PHP Version: Irrelevant
Block user comment: N
New Comment:
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 =]
Previous Comments:
------------------------------------------------------------------------
[2010-11-01 04:55:07] [email protected]
Not adequate to PHP for several reasons:
* Type of arguments cannot be provided expect in limited circumstances,
and even then it's not required.
* The only differentiating factor would be the number of arguments, but
in PHP a function can take more arguments than it declares, so even
then...
------------------------------------------------------------------------
[2010-11-01 01:34:11] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53215&edit=1