Skip to content

Instantly share code, notes, and snippets.

@suzuken
Created October 5, 2017 01:25
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 suzuken/e579861d4b0592ead83703076c0f04f5 to your computer and use it in GitHub Desktop.
Save suzuken/e579861d4b0592ead83703076c0f04f5 to your computer and use it in GitHub Desktop.
<?php
class A {
public $a = 1;
}
$a = new A;
var_dump($a);
$b = $a;
$c = clone $a;
$a->a = 2;
var_dump($b);
var_dump($c);
// 2017object(A)#2 (1) {
// ["a"]=>
// int(1)
// }
// object(A)#2 (1) {
// ["a"]=>
// int(2)
// }
// object(A)#3 (1) {
// ["a"]=>
// int(1)
// }
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment