note 79402 added to function.strstr
| From: | brett dot jr dot alton at gmail dot com | Date: | Sun, 25 Nov 2007 16:00:31 +0000 |
| Subject: | note 79402 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132559@lists.php.net to get a copy of this message | ||
For the needle_before (first occurance) parameter when using PHP 5.x or less, try:
<?php
$haystack = 'php-homepage-20071125.png';
$needle = '-';
$result = substr($haystack, 0, strpos($haystack, $needle)); // $result = php
?>
----
Server IP: 66.207.199.35
Probable Submitter: 72.38.56.31
----
Manual Page -- http://www.php.net/manual/en/function.strstr.php
Edit -- https://master.php.net/note/edit/79402
Del: integrated -- https://master.php.net/note/delete/79402/integrated
Del: useless -- https://master.php.net/note/delete/79402/useless
Del: bad code -- https://master.php.net/note/delete/79402/bad+code
Del: spam -- https://master.php.net/note/delete/79402/spam
Del: non-english -- https://master.php.net/note/delete/79402/non-english
Del: in docs -- https://master.php.net/note/delete/79402/in+docs
Del: other reasons-- https://master.php.net/note/delete/79402
Reject -- https://master.php.net/note/reject/79402
Search -- https://master.php.net/manage/user-notes.php