The statement is returned true regardless of the condition

For example, if I have

assert('2<1');

It turns out that the statement returns as true. I also copy example # 2 from http://php.net/manual/en/function.assert.php , and he also rated each statement as true when this is clearly not the case. Any idea what could be causing this?

Edit -

<?php
    var_dump(assert('2<1'));
?>

Output

true

If I ran this at http://sandbox.onlinephpfunctions.com/ , the statement will not complete as expected. However, this does not happen on my test server.

Edit # 2 - PHP Version:

PHP 7.0.9-1+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.9-1+deb.sury.org~trusty+1, Copyright (c) 1999-2016, by Zend Technologies
+4
source share
1 answer

Assert has 3 settings:

(exert from php.ini):

-1: 0:
1:
...
http://php.net/zend.assertions

-1 "", 1 - , - , , -, .

-, , assert true, .

+4

Source: https://habr.com/ru/post/1653552/


All Articles