I have a PHP class file A with a static variable, I have one class file B that uses that class A and instantiates its static variable. i wish to access Class A's ststic varibale from another class C in another file. How do i do this. I tried this
classA.php
<?php
Class A{
public static $foo = array ();
public static function doSomething(){
//... Do some process and instantiate static vairable $face
$face = outputofsomeprocess();
}
}
?>
classB.php
<?php
require_once "classA.php";
class B{
public function dosomethingelse(){
classA::doSomething();
}
}
?>
classC.php
<?php
require_once "classA.php";
class C{
public function dosomethingelse(){
echo classA::$foo[0];
}
}
?>
How do I do this correctly, because in classC classA::$foo[0] return null.