Req #53215 [NEW]: Method overload on PHP

From: Date: Mon, 01 Nov 2010 00:34:12 +0000
Subject: Req #53215 [NEW]: Method overload on PHP
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155668@lists.php.net to get a copy of this message
From:             
Operating system: Windows XP
PHP version:      Irrelevant
Package:          Class/Object related
Bug Type:         Feature/Change Request
Bug description:Method overload on PHP

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 bug report at http://bugs.php.net/bug.php?id=53215&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53215&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53215&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53215&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53215&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53215&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53215&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53215&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53215&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53215&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53215&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53215&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53215&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53215&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53215&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53215&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53215&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53215&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53215&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53215&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53215&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53215&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#155668) next »