Answers for "static::"

0

static::

<?php
class a{

static protected $test="class a";

public function static_test(){

echo static::$test; // Results class b
echo self::$test; // Results class a

}

}

class b extends a{

static protected $test="class b";

}

$obj = new b();
$obj->static_test();
?>
Posted by: Guest on May-03-2021

Browse Popular Code Answers by Language