note 92831 deleted from function.explode by peehaa
| From: | peehaa@php.net | Date: | Sat, 10 Dec 2016 14:11:41 +0000 |
| Subject: | note 92831 deleted from function.explode by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208454@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
If you are exploding string literals in your code that have a dollar sign ($) in it, be sure to use
single-quotes instead of double-quotes, since php will not spare any chance to interpret the
variable-friendly characters after the dollar signs as variables, leading to unintended
consequences, the most typical being missing characters.
<?php
$doubleAr = explode(" ", "The $quick brown fox");
$singleAr = explode(" ", 'The $quick brown fox');
echo $doubleAr[1]; // prints "";
echo $singleAr[1]; // prints "$quick";
?>