note 47628 deleted from function.explode by bjori

From: Date: Mon, 25 Sep 2006 08:11:44 +0000
Subject: note 47628 deleted from function.explode by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117598@lists.php.net to get a copy of this message
Note Submitter: matzie at dontspamme dot bitdifferent dot com ---- The separator parameter in double quotes not single ones. Having got into the habit (for performance) of using double quotes only when I really want variable substitution etc, I was doing this (intending to split a string into lines) <?PHP $strFoo = "Hello World Goodbye World"; $arrFoo = explode ('\n', $strFoo); ?> and it wasn't working. I changed the single quotes for double ones and it started working. (Incidentally I then recombined the array back into a string implode()d with '\' (the Javascript line continuation character) to give a multi-line string that could be document.write()'d with Javascript).

« previous php.notes (#117598) next »