Check various return values from strcmp in PHP

Description

The following code shows how to check various return values from strcmp.

Example


/*from w w  w  .  ja  v a 2s. c om*/
<?php
    echo strcmp("Hello world!","Hello world!"); // the two strings are equal
    echo strcmp("Hello world!","Hello"); // string1 is greater than string2
    echo strcmp("Hello world!","Hello world! Hello!"); // string1 is less than string2
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone