note 108202 deleted from function.overload by sobak
| From: | sobak@php.net | Date: | Sun, 04 Dec 2016 07:38:43 +0000 |
| Subject: | note 108202 deleted from function.overload by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208138@lists.php.net to get a copy of this message | ||
Note Submitter: admin at skewedconcepts dot ca
----
PHP does not have method overloading as with other languages. The only option is to use optional
arguments.
This is a better testing scenario as described in the other post:
<?php
class Test
{
function Test($name = "stranger")
{
echo "Hello, $name";
}
}
$t1=new Test(); // Output : Hello, stranger
$t2=new Test('Osman Kalache'); // Output : Hello, Osman Kalache
?>