<?php
class Statics {
private static $keyword;
public static function __callStatic($name,$args){
self::$keyword = "google";
}
public static function TellMe(){
echo self::$keyword;
}
}
Statics::TellMe();
This is a simple breakdown I tried using __construct
but the way I write the code Statics::TellMe();
I would need to write new
for the __construct
to work. And my private static variable keyword
does not get written without it being called any ideas as to why this is not working??
private static $pathname;
public function __construct($dir = "")
{
set_include_path(dirname($_SERVER["DOCUMENT_ROOT"]));
if($dir !== "") {
$dir = "/".$dir;
}
self::$pathname = $dir.".htaccess";
if( file_exists(self::$pathname) ) {
self::$htaccess = file_get_contents($dir.".htaccess",true);
self::$htaccess_array = explode("\n",self::$htaccess);
}
}
The self::$patname
is not getting assigned because I am not doing $key = new Key();
so I need a way to do it if I just do Key::get()
or anything like that.