Result Size: 625 x 571
x
 
<!DOCTYPE html>
<html>
<body>
<?php
class pi {
  public static $value=3.14159;
}
class x extends pi {
  public function xStatic() {
    return parent::$value;
  } 
}
// Get value of static property directly via child class
echo x::$value;
// Get value of static property via xStatic() method
$x = new x();
echo $x->xStatic();
?>
 
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_static_prop3 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:50:50 GMT -->
</html>
×

Report a Problem: