|
Posted by Toby A Inkster on 04/20/07 10:18
Hendri Kurniawan wrote:
> $my_arr = explode(',', implode(',|,', $my_arr));
This will work given the example array, but won't in the general case.
Take for example, the following input:
$sinatra_songs = array(
"My Way",
"New York, New York",
"Strangers in the Night",
"Ol' Man River",
"Something Stupid",
"Bad, Bad Leroy Brown",
"That's Life"
);
You could work around that by choosing something other than a comma --
something virtually guaranteed to be unique -- as a divider.
$u = md5(microtime().rand(1,1000));
$my_arr = explode($u, implode("$u|$u", $my_arr));
--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
Navigation:
[Reply to this message]
|