note 92884 added to function.strlen

From: Date: Thu, 13 Aug 2009 02:08:22 +0000
Subject: note 92884 added to function.strlen
Groups: php.notes 
Request: Send a blank email to php-notes+get-159424@lists.php.net to get a copy of this message
I have ran into a strange situation, when i wanted to process some strings, and i noticed the following: <?php echo (strlen("\\")); ?> will return 1 instead of 2, so watch out if you want mass processing strings, and the length has to be known for them, and they can contain such a substring. That is the case even if you read the string from a file or stream, and try to get its length. The use of the addslashes() function can solve the problem. ---- Server IP: 69.147.83.197 Probable Submitter: 157.181.119.145 (proxied: 157.181.193.191) ---- Manual Page -- http://www.php.net/manual/en/function.strlen.php Edit -- https://master.php.net/note/edit/92884 Del: integrated -- https://master.php.net/note/delete/92884/integrated Del: useless -- https://master.php.net/note/delete/92884/useless Del: bad code -- https://master.php.net/note/delete/92884/bad+code Del: spam -- https://master.php.net/note/delete/92884/spam Del: non-english -- https://master.php.net/note/delete/92884/non-english Del: in docs -- https://master.php.net/note/delete/92884/in+docs Del: other reasons-- https://master.php.net/note/delete/92884 Reject -- https://master.php.net/note/reject/92884 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159424) next »