Req #53215 [Opn->Bgs]: Method overload on PHP

From: Date: Mon, 01 Nov 2010 03:55:07 +0000
Subject: Req #53215 [Opn->Bgs]: Method overload on PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155669@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53215&edit=1

 ID:                 53215
 Updated by:         cataphract@php.net
 Reported by:        jonimane at gmail dot com
 Summary:            Method overload on PHP
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
 Package:            Class/Object related
 Operating System:   Windows XP
 PHP Version:        Irrelevant
 Block user comment: N

 New Comment:

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...


Previous Comments:
------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#155669) next »