I
I
Ivan2022-02-13 10:21:58
phpstorm
Ivan, 2022-02-13 10:21:58

Why does PHP Storm highlight variables in red if they are included from another file?

There are 2 files in the project: index.php and config.php.

config.php included in index.php
file config.php index.php
$workmode = 1;

require('config.php');
if ($workmode == 0) {
    echo 'Проверка отключена.';
    exit;
}

Here $workmode is underlined in red.

However, despite this, in the index.php file, the variables defined in the config are highlighted in red.
Writes Undefined variable '$workmode' . The script itself works.

How to fix it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question