The below is example2 from php.net's splobjectstorage documentation. The lines using $s[$o1] and $s[$o2] is syntax I'm not familiar with and haven't seen yet for objects (still learning)
Is this a standard way of fetching properties from an object that would work with any class I've created?
Is this instead using a magic method or additional programmed functionality to create this syntax for just this class?
<?php
// As a map from objects to data
$s = new SplObjectStorage();
$o1 = new StdClass;
$o2 = new StdClass;
$o3 = new StdClass;
$s[$o1] = "data for object 1";
$s[$o2] = array(1,2,3);
if (isset($s[$o2])) {
var_dump($s[$o2]);
}
?>