I have some trouble with my code. I want call object array value in my method, bu have that errors:
Notice: Undefined variable: login_error in C:\xampp\htdocs\frontend\controller\Users.php on line 27
Notice: Trying to get property of non-object in C:\xampp\htdocs\frontend\controller\Users.php on line 27
That is my controller Users.php
class Users extends Controller
{   
    function doLogin(){
        if(isset($_POST['zaloguj'])){
            Users::error($login_error->empty);
        }
    }
}
And Language file where I have my object array.
<?php 
$login_error = (object) array(
    'empty' => 'ERROR TEXT',
    'dberror' => 'ERROR TEXT 2'
);
?>
Global Controller with my error function:
public function error($text){
        echo '<div class="alert alert-danger">
          <strong>Błąd!</strong> '.$text.'</div>';
    }
    public function success($text){
        echo '<div class="alert alert-success">
          <strong>Brawo!</strong> '.$text.'</div>';
    }
    public function info($text){
        echo '<div class="alert alert-info">
          <strong>Uwaga!</strong> '.$text.'</div>';
    }
And loader - I load all my controlers in ONE file.
<?php
require_once('config.php');
///////////////////////////////////
// INCLUDING LANGUAGES
///////////////////////////////////
include('frontend/language/pl_PL.php');
///////////////////////////////////
// INCLUDING CONTROLERS
//////////////////////////////////
require_once('frontend/controller/Controller.class.php');
require_once('frontend/controller/Users.php');
//////////////////////////////////
// INCLUDING MODELS
//////////////////////////////////
require_once('frontend/model/model.php');
require_once('frontend/model/Users.php');
?>
 
     
    