note 92883 deleted from function.strlen by danbrown
| From: | danbrown@php.net | Date: | Mon, 24 Aug 2009 17:01:39 +0000 |
| Subject: | note 92883 deleted from function.strlen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159833@lists.php.net to get a copy of this message | ||
Note Submitter: pifta at csoma dot elte dot hu
----
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.