如何在数组中拆分一行?

Example :

Array
    (
          [0] => "example.fr", "2013-08-24", "test"
          [1] => "toto.com, "2014-10-01", "test2"
    )

How can I do to split this array every comma ? I would like to get every word in quotes into a variable like this :

    $var1= "example.fr";
    $var2= "2013-08-24";
    $var3 = "test";
....

EDIT: The structure of the array is GOOD ! Every element is enclosed in quotes in ONLY one array ! Like CSV file

Don't reinvent a CSV parser, use the existing functionality.

From PHP 5.3+:

$parsed = array_map('str_getcsv', $array);

http://php.net/str_getcsv

Before 5.3:

$fh = fopen('php://temp', 'r+');

$parsed = array();
foreach ($array as $row) {
    ftruncate($fh, 0);
    fwrite($fh, $row);
    rewind($fh);
    $parsed[] = fgetcsv($fh);
}
fclose($fh);

Unless I'm misunderstanding you, you can access the array elements and assign them to variables like this:

$var1 = $arrayName[0][0];
$var2 = $arrayName[0][1];
$var3 = $arrayName[0][2];

I can't tell from you're question if the array is holding a single string per index or if it is a 2D array. If it's holding strings then see realshadow's answer.

Use explode on every item of the array: http://www.w3schools.com/php/func_string_explode.asp

You can use list

array("example.fr, 2013-08-24, test")

list($var1, $var2, $var3) = explode(', ', $array[0]); // or current

I don't think your syntax is quite right to create a multidimensional array, consider this example:

$myArray = array( array("example.fr", "2013-08-24", "test"),
           array("toto.com, "2014-10-01", "test2")); 

Now you have an array of arrays and can iterate over each.

If you know for sure how many items you have in each array then you can explode the array into its constituents, but if you don't know before hand than iterating will see you through.

I am not very sure with the structure, but let me know if this is what ur looking for, happy to help u then -

<?php

$myarr = array( array("example.fr", "2013-08-24", "test"),array("toto.com", "2014-10-01", "test2"));

foreach($myarr as $breakpart)
{
echo "<pre>";     
print_r($breakpart);
}

OUTPUT -

Array
(
    [0] => example.fr
    [1] => 2013-08-24
    [2] => test
)

Array
(
    [0] => toto.com
    [1] => 2014-10-01
    [2] => test2
)

Codepad Link - codepad.org/6S7EMldq