note 68562 rejected from function.strcmp by bjori

From: Date: Wed, 02 Aug 2006 13:08:47 +0000
Subject: note 68562 rejected from function.strcmp by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115481@lists.php.net to get a copy of this message
Note Submitter: jeff at skrysak dot com ---- strcmp does not just return -1, 0, or 1. It returns values greater or less than zero, so it may return 14, or -28. It returns a non-zero value if the two strings being compared are not identical, and that non-zero value is the number of characters difference between them. Try this as an example: $difference = strcmp("red", "blue"); echo $difference; The output is: 16 Another example: $difference = strcmp("a", "1"); echo $difference; The output is: -48

« previous php.notes (#115481) next »