[Typo3-dev] OT: Wonders of PHP
    Wolfgang Klinger 
    wolfgang at stufenlos.net
       
    Sun Nov  6 18:24:15 CET 2005
    
    
  
 Hi!
 On Sun, 06 Nov 2005, Bernhard Kraft wrote the following:
> And as php is some kind of magic gadget toolset compilation it wonderully outputed "wonderful" !!!
> 
> Nifty things you could do with knowing that !
 For the curious:
 You can do similar things with class instances too:
----
class myTest {
    var $param1 = null;
    var $param2 = null;
    function myTest($param1, $param2) {
        $this->param1 = $param1;
        $this->param2 = $param2;
    }
}
$instance1 = new myTest('bla', 'blu');
$instance2 = new myTest('bi', 'bo');
$test_instance = new myTest('bi', 'bo');
switch ($test_instance) {
    case $instance1:
            echo 'looks like instance1';
            break;
    case $instance2:
            echo 'looks like instance2';
            break;
    default:
            echo 'no match';
}
----
 (outputs "looks like instance2")
 bye
 Wolfgang
    
    
More information about the TYPO3-dev
mailing list