K
K
Kanat Kharasaev2018-02-22 20:59:51
PHP
Kanat Kharasaev, 2018-02-22 20:59:51

What could be the problem with php notice: Use of undefined constant string - assumed 'string' in?

I can’t understand what the error is, it says Notice Notice: Use of undefined constant string - assumed 'string' in
You can, of course, remove the output of notice errors, but still unpleasant

function system_load($name,$options = array()) {
    $name = strtolower($name);
    $file = ROOT . 'system/core/' . $name . '.php';
    if (is_file($file)) {
        require_once($file);
        if (class_exists($name)) {
            if (count($options) > 0)
            return new $name($options); 
        else return new $name;
        } else return FALSE;
    } else
        return FALSE;
}

It throws an error on the line: return new $name($options);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-02-22
@Rsa97

Most likely, the error is not in this function, but in the class file, an instance of which is created through new.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question