String- and numeric-comparison operators.
String operator Comparison operation Equivalent numeric operator
lt Less than <
gt Greater than >
eq Equal to ==
le Less than or equal to <=
ge Greater than or equal to >=
ne Not equal to !=
cmp Compare, returning 1, 0, or -1 <=>
Here are some examples of string-comparison operators in action:
$result = "aaa" lt "bbb"; # result is true
$result = "aaa" gt "bbb"; # result is false
$result = "aaa" eq "bbb"; # result is false
$result = "aaa" le "aaa"; # result is true
$result = "aaa" ge "bbb"; # result is false
$result = "aaa" ne "aaa"; # result is false
$result = "aaa" cmp "bbb"; # result is -1
Related examples in the same category