Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

prova

<?php
abstract class ClassA
{
  public static function Foo($sum)
  {
    static $var = 1;
    
    echo $var + $sum;
  }
}

class ClassB extends ClassA
{
    public static function Foo($sum)
    {
        static $var = 2;
        echo $var + $sum;
    }
    
    public function Self()
    {
        self::Foo(4);
    }
    
    public function Parent()
    {
        parent::Foo(5);
    }
    
    public function Static()
    {
        static::Foo(6);
    }
    
    public function className()
    {
        classA::Foo(7);
    }
}

$test = new ClassB;
$test->Self();
echo "\n";
$test->Parent();
echo "\n";
$test->Static();
echo "\n";
$test->className();

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.