st0bsel
st0bsel

Reputation: 15

PHP7.2 A non-numeric value encountered

the following part of my code worked fine under PHP7.0:

if (Config::LOG_LEVEL == 'debug' | 'basic' | 'light') {}

I have now updated to PHP7.2 and the following error message appears:

A non-numeric value encountered

does anyone have any idea how i can fix this bug?

Upvotes: 0

Views: 474

Answers (1)

arueckauer
arueckauer

Reputation: 352

As commented by others already, the code won't work as expected (usage of bitwise operator). Try in_array() instead.

in_array(Config::LOG_LEVEL, ['debug', 'basic', 'light'])

See https://3v4l.org/ScWH5

Upvotes: 1

Related Questions