note 68562 added to function.strcmp

From: Date: Tue, 01 Aug 2006 23:21:47 +0000
Subject: note 68562 added to function.strcmp
Groups: php.notes 
Request: Send a blank email to php-notes+get-115431@lists.php.net to get a copy of this message
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 ---- Server IP: 64.71.164.2 Probable Submitter: 192.203.136.246 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.strcmp.php Edit -- https://master.php.net/note/edit/68562 Del: integrated -- https://master.php.net/note/delete/68562/integrated Del: useless -- https://master.php.net/note/delete/68562/useless Del: bad code -- https://master.php.net/note/delete/68562/bad+code Del: spam -- https://master.php.net/note/delete/68562/spam Del: non-english -- https://master.php.net/note/delete/68562/non-english Del: in docs -- https://master.php.net/note/delete/68562/in+docs Del: other reasons-- https://master.php.net/note/delete/68562 Reject -- https://master.php.net/note/reject/68562 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115431) next »