version_compare() Stricter Operators
version_compare() compares version strings, using an operator, passed as third parameter. Until PHP 8.3, unknown operators are ignored, and the function uses the default value.
Valid values of comparisons are : <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne.
Nowadays, it is generating a fatal error.
PHP code
<?php
print version_compare('1.0', '2.3', '!');
?>
Before
1
After
PHP Fatal error: Uncaught ValueError: version_compare(): Argument #3 ($operator) must be a valid comparison operator
PHP version change
This behavior changed in 8.1.