<?php
class MyExceptions {
private static $object = null;
public $problem = array();
private function __construct() {}
public function setProblem($msg, $code) {
self::getInstance();
$this->problem = array('msg' => $msg, 'code' => $code);
}
public function getProblem() {
self::getInstance();
return $this->problem;
}
private function getInstance() {
if (self::$object == null) {
self::$object = new MyExceptions();
}
}
}
MyExceptions::setProblem("habibi",001);
var_dump(MyExceptions::getProblem());
Quote
Fatal error: Using $this when not in object context in D:\wamp\www\MyExceptions.php on line 11
Нещо не мога да я схвана тази грешка.


Sign In
Create Account

Back to top









