Compare two strings (case-insensitive): in PHP

Description

The following code shows how to compare two strings (case-insensitive):.

Example


//from  ww  w.  j a  va2s  .  c  o  m
<?php
    echo strcasecmp("Hello world!","HELLO WORLD!");
    echo "<br>";
    echo strcasecmp("Hello","HELLO");
    echo "<br>";
    echo strcasecmp("Hello","hELLo");
?>

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