note 49749 deleted from language.functions by nikic
| From: | nikic@php.net | Date: | Wed, 30 Apr 2014 15:28:35 +0000 |
| Subject: | note 49749 deleted from language.functions by nikic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199380@lists.php.net to get a copy of this message | ||
Note Submitter: roy at intelligentdashimaging dot com
----
Here's how to get static function behavior and instantiated object behavior in the same
function
<?php
// Test of static/non-static method overloading, sort of, for php
class test {
var $Id = 2;
function priint ($id = 0) {
if ($id == 0) {
echo $this->Id;
return;
}
echo $id;
return;
}
}
$tc = new test ();
$tc->priint ();
echo "\n";
test::priint (1);
/* output:
2
1
*/
?>