Skip to content

Instantly share code, notes, and snippets.

@suzuken

suzuken/a.php

Created Oct 5, 2017
Embed
What would you like to do?
<?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
You can’t perform that action at this time.