note 124577 added to function.explode
| From: | BarryDGold at ca dot rr dot com | Date: | Wed, 08 Jan 2020 08:44:11 +0000 |
| Subject: | note 124577 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213808@lists.php.net to get a copy of this message | ||
If the last character of the haystack is the delimiter, the output array will have an empty value as
the last element.
Example:
cat test.php
<?
<?
$s = "x;y";
echo '$s = ', "$s\n";
$a = explode(';', $s, 2);
print_r($a);
$s = "x;";
echo '$s = ', "$s\n";
$a = explode(';', $s, 2);
print_r($a);
result:
$s = x;y
Array
(
[0] => x
[1] => y
)
$s = x;
Array
(
[0] => x
[1] =>
)
----
Server IP: 45.112.84.4
Probable Submitter: 38.142.137.34 (proxied: 76.94.41.89)
----
Manual Page -- http://php.net/manual/en/function.explode.php
Edit -- https://master.php.net/note/edit/124577
Del: integrated -- https://master.php.net/note/delete/124577/integrated
Del: useless -- https://master.php.net/note/delete/124577/useless
Del: bad code -- https://master.php.net/note/delete/124577/bad+code
Del: spam -- https://master.php.net/note/delete/124577/spam
Del: non-english -- https://master.php.net/note/delete/124577/non-english
Del: in docs -- https://master.php.net/note/delete/124577/in+docs
Del: other reasons-- https://master.php.net/note/delete/124577
Reject -- https://master.php.net/note/reject/124577
Search -- https://master.php.net/manage/user-notes.php