[ create a new paste ] login | about

Link: http://codepad.org/XAmUEdYh    [ raw code | output | fork ]

PHP, pasted on Nov 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
   $dates = array(
        array("2012-11-01", "3238"),
        array("2012-11-03", "4321")
    );
    
    print_r($dates);
    
    $result = array();
    foreach($dates as $value) {
        $result[][$value[0]] = $value[1];
    }
    
    
    print_r($result);


Output:
Array
(
    [0] => Array
        (
            [0] => 2012-11-01
            [1] => 3238
        )

    [1] => Array
        (
            [0] => 2012-11-03
            [1] => 4321
        )

)
Array
(
    [0] => Array
        (
            [2012-11-01] => 3238
        )

    [1] => Array
        (
            [2012-11-03] => 4321
        )

)


Create a new paste based on this one


Comments: