note 109636 added to function.substr-compare

From: Date: Fri, 03 Aug 2012 13:55:32 +0000
Subject: note 109636 added to function.substr-compare
Groups: php.notes 
Request: Send a blank email to php-notes+get-189909@lists.php.net to get a copy of this message
Take note of the length parameter: "The default value is the largest of the length of the str compared to the length of main_str less the offset." This is *not* the length of str as you might (I always) expect, so if you leave it out, you'll get unexpected results. Example: <?php $hash = '$5$lalalalalalalala$crypt.output.here'; var_dump(substr_compare($hash, '$5$', 0)); # int(34) var_dump(substr_compare($hash, '$5$', 0, 3)); # int(0) var_dump(PHP_VERSION); # string(6) "5.3.14" ?> ---- Server IP: 192.41.42.26 Probable Submitter: 64.66.125.222 ---- Manual Page -- http://www.php.net/manual/en/function.substr-compare.php Edit -- https://master.php.net/note/edit/109636 Del: integrated -- https://master.php.net/note/delete/109636/integrated Del: useless -- https://master.php.net/note/delete/109636/useless Del: bad code -- https://master.php.net/note/delete/109636/bad+code Del: spam -- https://master.php.net/note/delete/109636/spam Del: non-english -- https://master.php.net/note/delete/109636/non-english Del: in docs -- https://master.php.net/note/delete/109636/in+docs Del: other reasons-- https://master.php.net/note/delete/109636 Reject -- https://master.php.net/note/reject/109636 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189909) next »