note 113364 added to function.strcmp

From: Date: Tue, 01 Oct 2013 18:52:49 +0000
Subject: note 113364 added to function.strcmp
Groups: php.notes 
Request: Send a blank email to php-notes+get-196441@lists.php.net to get a copy of this message
Since it may not be obvious to some people, please note that there is another possible return value for this function. strcmp() will return NULL on failure. This has the side effect of equating to a match when using an equals comparison (==). Instead, you may wish to test matches using the identical comparison (===), which should not catch a NULL return. --------------------- Example --------------------- $variable1 = array(); $ans === strcmp($variable1, $variable2); This will stop $ans from returning a match; Please use strcmp() carefully when comparing user input, as this may have potential security implications in your code. ---- Server IP: 64.71.164.2 Probable Submitter: 207.97.144.238 ---- Manual Page -- http://php.net/manual/en/function.strcmp.php Edit -- https://master.php.net/note/edit/113364 Del: integrated -- https://master.php.net/note/delete/113364/integrated Del: useless -- https://master.php.net/note/delete/113364/useless Del: bad code -- https://master.php.net/note/delete/113364/bad+code Del: spam -- https://master.php.net/note/delete/113364/spam Del: non-english -- https://master.php.net/note/delete/113364/non-english Del: in docs -- https://master.php.net/note/delete/113364/in+docs Del: other reasons-- https://master.php.net/note/delete/113364 Reject -- https://master.php.net/note/reject/113364 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196441) next »