explode, preg_match, what is best in my case?

From: Sims (siminfrance_at_hotmail.com)
Date: 12/30/03


Date: Tue, 30 Dec 2003 18:47:47 +0200

Hi,

if i have a line like
$a = 0:1:2, i can use explode to create an array.

$exploded[0] = 0;
$exploded[1] = 1;
$exploded[2] = 2;

but if i have

$a= 0:"1:2":2:3:4, i get...

$exploded[0] = 0;
$exploded[1] = "1;
$exploded[2] = 2";
$exploded[3] = 2;
$exploded[4] = 3;
$exploded[5] = 4;

but it should be...

$exploded[0] = 0;
$exploded[1] = 1:2;
$exploded[2] = 2;
$exploded[3] = 3;
$exploded[4] = 4;

how can i explode the data that is not within \"\".

I used

preg_match("/([a-z]*)=([^\"]*)/i", ..., ... ); but it does not always work,
(special chars like '_' cause errors

Many thanks

Sims