note 76705 added to ref.strings
| From: | m at osu1 dot php dot net | Date: | Fri, 27 Jul 2007 00:10:04 +0000 |
| Subject: | note 76705 added to ref.strings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128954@lists.php.net to get a copy of this message | ||
Regarding the code for the function beginsWith($str, $sub), I found that it has problems when only
one character is present after the string searched for. I found that this works better instead:
<?php
function beginsWith($str, $sub) {
return (strncmp($str, $sub, strlen($sub)) == 0);
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 87.80.210.29
----
Manual Page -- http://www.php.net/manual/en/ref.strings.php
Edit -- https://master.php.net/note/edit/76705
Del: integrated -- https://master.php.net/note/delete/76705/integrated
Del: useless -- https://master.php.net/note/delete/76705/useless
Del: bad code -- https://master.php.net/note/delete/76705/bad+code
Del: spam -- https://master.php.net/note/delete/76705/spam
Del: non-english -- https://master.php.net/note/delete/76705/non-english
Del: in docs -- https://master.php.net/note/delete/76705/in+docs
Del: other reasons-- https://master.php.net/note/delete/76705
Reject -- https://master.php.net/note/reject/76705
Search -- https://master.php.net/manage/user-notes.php