Skip to content

Instantly share code, notes, and snippets.

@robballou
Created April 20, 2009 19:52
Show Gist options
  • Save robballou/98710 to your computer and use it in GitHub Desktop.
Save robballou/98710 to your computer and use it in GitHub Desktop.
<?php
class A {
public $id;
public function __construct($id){
$this->id = $id;
}
}
$a = new A(10);
print '$a->id = '. $a->id .'<br />';
$b = new A(12);
print '$b->id = '. $b->id .'<br />';
$b = $a;
print 'After: $b->id = '. $b->id .'<br />';
$b->id = 15;
print 'After: $b->id = '. $b->id .'<br />';
print 'After: $a->id = '. $a->id .'<br />';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment