-
-
Save beberlei/7f91cdb40233f75eea4031b92829e5d6 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 Foo { | |
| public string $foo = 'foo'; | |
| public function setString($value): void { | |
| $this->foo = $value; | |
| } | |
| public function getString(): string { | |
| return $this->foo; | |
| } | |
| } | |
| $foo = new Foo(); | |
| $bar = null; | |
| $iter = 10_000_000; | |
| while(--$iter) { | |
| $foo->setString("foo" . $iter); | |
| $bar = $foo->getString(); | |
| } |
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 Foo { | |
| private string $_foo; | |
| public string $foo { | |
| get => $this->_foo; | |
| set { $this->_foo = $value; } | |
| } | |
| } | |
| $foo = new Foo(); | |
| $bar = null; | |
| $iter = 10_000_000; | |
| while(--$iter) { | |
| $foo->foo = "foo" . $iter; | |
| $bar = $foo->foo; | |
| } |
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 Foo { | |
| public string $foo = 'foo'; | |
| } | |
| $foo = new Foo(); | |
| $bar = null; | |
| $iter = 10_000_000; | |
| while(--$iter) { | |
| $foo->foo = "foo" . $iter; | |
| $bar = $foo->foo; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment