我需要推送阵列标准格式

时间:2015-07-05 05:18:56

标签: php arrays

阵列

Array (
    [0] => 1436073376-java_tutorial.pdf 
    [isread] => 0 
)
Array (
    [0] => 1436073294-hadoop_tutorial.pdf 
    [isread] => 0 
)

我需要预期的输出,如

Array (
    [0] => 1436073376-java_tutorial.pdf 
    [isread] => 0
),
Array (
    [1] => 1436073294-hadoop_tutorial.pdf 
    [isread] => 0 
)

我试过的是

$filenameuploaded = array_push($1starray,$secondarry);  

我该怎么做?

1 个答案:

答案 0 :(得分:0)

您可以这样做:

$array1 = array(
    '0' => '1436073376-java_tutorial.pdf',
    'isread' => 0
);
$array2 = array(
    '1' => '1436073294-hadoop_tutorial.pdf',
    'isread' => 0
);

$result[] = $array1;
$result[] = $array2;
echo '<pre>';
print_r($result);