Created
August 9, 2017 06:40
-
-
Save myanmarlinks/353417280bfa8da76e1aab174a44efe2 to your computer and use it in GitHub Desktop.
PHP Magic Method __toString()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Dog { | |
public $test = "Hello from Dog Class"; | |
public function __toString() { | |
return $this->test; | |
} | |
} | |
$dog = new Dog(); | |
echo $dog; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment