must be a valid comparison operator

Description

version_compare() compares version strings, using an operator, passed as third parameter. Until PHP 8.1, unknown operators are ignored, and use the default value.

Nowadays, it is generating a fatal error.

Valid operators are : <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne

Note that the 3rd parameter is case sensitive, so NE also yields the error.

Example

<?php

version_compare('1.2.4', '1.2.3', '?');

?>

Solutions

  • Use a valid operator.

Changed Behavior

This error may appear in different PHP versions version_compare.