<?php
$string1 = "12 jan";
$string2 = "12 aprail, 13 march";
$result = strcmp($string1, $string2);
switch ($result) {
case -1: print "date are not identical"; break;
case 0: print "date1"; break;
case 1: print "date are identical"; break;
}
?>
when i use this code it will show me a date are identical even the value ex when i compare the value 12 jan to 12 march it will show me value are identical but the value is differ
You have used the wrong return values.
-1 and 1 mean that the strings are not identical (less than and greater than, respectively).0 means that the strings are identical.The function strcmp returns
< 0 if str1 is less than str2;
> 0 if str1 is greater than str2, and
0 if they are equal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With