note 124577 deleted from function.explode by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 14:48:42 +0000 |
| Subject: | note 124577 deleted from function.explode by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215321@lists.php.net to get a copy of this message | ||
Note Submitter: BarryDGold at ca dot rr dot com
----
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] =>
)