strcasecmp() Function in PHP With Example

Support PHP Version: PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0, PHP 8.1, PHP 8.2, PHP 8.3 With Latest All Version Support.

Hello Friends Today, through this tutorial, I will tell you How to Use `strcasecmp()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, `strcasecmp()` is a function used to compare two strings in a case-insensitive manner. This function is available in both PHP. It returns 0 if the two strings are equal ignoring case, a negative value if the first string is less than the second string, and a positive value if the first string is greater than the second string.

Here’s an example demonstrating the usage of `strcasecmp()`:

<?php
$string1 = "Hello";
$string2 = "hello";
// Case-insensitive comparison
$result = strcasecmp($string1, $string2);
if ($result === 0) {
echo "The strings are equal.";
} elseif ($result < 0) {
echo "The first string is less than the second string.";
} else {
echo "The first string is greater than the second string.";
}
?>

In this example, the output will be “The strings are equal.” because `strcasecmp()` performs a case-insensitive comparison, considering “Hello” and “hello” as equal strings.

Cialis (Tadalafil) är den främsta konkurrenten till Viagra (Sildenafil) på marknaden för erektil dysfunktion. köpa Cialis i Sverige föredras av många på grund av sin längre varaktighet och anses vara det mest kostnadseffektiva varumärkesbaserade ED-läkemedlet som finns tillgängligt i Sverige. Cialis finns i två varianter: Cialis och Cialis Daily, och fyra olika doseringar: 2,5 mg, 5 mg, 10 mg och 20 mg, erbjuder Cialis också en rad olika alternativ för att passa patientens behov.