Skip to content

Instantly share code, notes, and snippets.

@myanmarlinks
Created August 9, 2017 06:40
Embed
What would you like to do?
PHP Magic Method __toString()
<?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