Created
January 6, 2020 21:35
-
-
Save Cvar1984/914fdedbdb88f8dd56c68667b16e17da 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 MyClass | |
| { | |
| public int $property; | |
| } | |
| $obj = new MyClass(); | |
| $obj->property = 1; | |
| $normal = $obj->property; | |
| $reference = &$obj->property; // always have same value | |
| $obj->property = 2; // update new value | |
| echo $normal . PHP_EOL; // 1 | |
| echo $reference . PHP_EOL; // 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment