note 127698 added to function.explode
| From: | Alejandro-Ihuit at main dot php dot net | Date: | Thu, 06 Oct 2022 15:04:52 +0000 |
| Subject: | note 127698 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219647@lists.php.net to get a copy of this message | ||
If you want to directly take a specific value without having to store it in another variable, you
can implement the following:
$status = 'Missing-1';
echo $status_only = explode('-', $status)[0];
// Missing
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.161 (proxied: 201.99.97.41)
----
Manual Page -- https://php.net/manual/en/function.explode.php
Edit -- https://main.php.net/note/edit/127698
Del: integrated -- https://main.php.net/note/delete/127698/integrated
Del: useless -- https://main.php.net/note/delete/127698/useless
Del: bad code -- https://main.php.net/note/delete/127698/bad+code
Del: spam -- https://main.php.net/note/delete/127698/spam
Del: non-english -- https://main.php.net/note/delete/127698/non-english
Del: in docs -- https://main.php.net/note/delete/127698/in+docs
Del: other reasons-- https://main.php.net/note/delete/127698
Reject -- https://main.php.net/note/reject/127698
Search -- https://main.php.net/manage/user-notes.php