Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

$this


<?php
class Test
{
    static public function getNew()
    {
        return new static;
    }
}

class Child extends Test
{}

$obj1 = new Test();
$obj2 = new $obj1;
var_dump($obj1 !== $obj2);

$obj3 = Test::getNew();
var_dump($obj3 instanceof Test);

$obj4 = Child::getNew();
var_dump($obj4 instanceof Child);
?>

Source by www.php.net #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
9+1 =