Skip to content

Instantly share code, notes, and snippets.

@elishaukpong
Created May 2, 2022 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elishaukpong/3734f9034aa848e4f9928d09f9edc85e to your computer and use it in GitHub Desktop.
Save elishaukpong/3734f9034aa848e4f9928d09f9edc85e to your computer and use it in GitHub Desktop.
class OOPExample
{
public function __construct($name)
{
$this->name = $name;
}
public function sayName(){
echo $this->name;
}
}
$john = new OOPExample('John');
$john->sayName(); //John
$peter = new OOPExample('Peter');
$peter->sayName(); // Peter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment