Created
July 10, 2024 06:26
-
-
Save jamesasu/4ead7f30d97d827dcba02bd53005cb5d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Hello { | |
protected string $name = ''; | |
public function __construct() { | |
return $this; | |
} | |
public function setName(string $name): Hello { | |
$this->name = $name; | |
return $this; | |
} | |
public function getName(): string { | |
return $this->name; | |
} | |
} | |
$hello = (new Hello())->setName('James'); | |
echo $hello->getName() . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment