Hi Brandon:

> http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html

Yeah, that's a good article.  I've seen it on other occasions.  But she's 
kind of "lying" too...

<?php

// Regular variables' "copy-on-write reference set" Sara discusses:
$a = 'foo';
$b = $a;
$a = 'bar';
echo "\$a = $a, \$b = $b\n";


// While Sara is right about "copy-on-write reference set" being
// the model when changing objects to other data types:
class copy_on_write {
    public $m = 'foo';
}
$a = new copy_on_write;
$b = $a;
$a = 'bar';
echo "\$a = $a, \$b->m = $b->m\n";


// Copy-on-write is not what happens when dealing only with objects:
class not_copy_on_write {
    public $m = 'foo';
}
$a = new not_copy_on_write;
$b = $a;
$a->m = 'bar';
echo "\$a->m = $a->m, \$b->m = $b->m\n";

?>


It may be nice to put examples like these into the manual.

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

Reply via email to