Below is my code in php,and I am getting error:
Parse error: syntax error, unexpected '[' in /LR_StaticSettings.php on line 4
<?php
class StaticSettings{
function setkey ($key, $value) {
self::arrErr[$key] = $value; // error in this line
}
}
?>
I want to use statically not $this->arrErr[$key] so that I can get and set static properties without creating instance/object.
Why is this error? Can't we create static array?
If there is another way, please tell me. Thanks
$arrErras a static member variable. You should declare it aspublic static $arrErr = array();