合并两个不同的数组,然后使用foreach将它们显示为php [英] merge two different array and then display them php using foreach

查看:61
本文介绍了合并两个不同的数组,然后使用foreach将它们显示为php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的...我有两个动态数组..它们的列不同

i am new here...I have two dynamic arrays..their columns are different

第一个数组:

Array
(
    [0] => Array
        (
            [id] => 102
            [parent_id] => 94
            [dir_name] => games
            [size] => 
            [owner_id] => 10
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/games
            [shared] => 0
            [comment] => 
            [add_date] =>  07/30/2013 02:43 AM
            [update_date] =>  07/30/2013 02:43 AM
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/games
            [trash_status] => 1
            [password] => 
            [expires_after] => 0
            [allow_uploading] => 0
            [share_date] => 
        )

    [1] => Array
        (
            [id] => 122
            [parent_id] => 94
            [dir_name] => New Folder
            [size] => 777835
            [owner_id] => 10
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/New Folder
            [shared] => 0
            [comment] => 
            [add_date] =>  08/16/2013 08:31 AM
            [update_date] =>  08/16/2013 08:31 AM
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/New Folder
            [trash_status] => 1
            [password] => 
            [expires_after] => 0
            [allow_uploading] => 0
            [share_date] => 
        )

    [2] => Array
        (
            [id] => 98
            [parent_id] => 94
            [dir_name] => Videos
            [size] => 
            [owner_id] => 10
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Videos/
            [shared] => 0
            [comment] => 
            [add_date] =>  07/30/2013 02:38 AM
            [update_date] =>  07/30/2013 02:38 AM
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Videos/
            [trash_status] => 1
            [password] => 
            [expires_after] => 0
            [allow_uploading] => 0
            [share_date] => 
        )

    [3] => Array
        (
            [id] => 97
            [parent_id] => 94
            [dir_name] => Pictures
            [size] => 
            [owner_id] => 10
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Pictures/
            [shared] => 0
            [comment] => 
            [add_date] =>  07/30/2013 02:38 AM
            [update_date] =>  07/30/2013 02:38 AM
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Pictures/
            [trash_status] => 1
            [password] => 
            [expires_after] => 0
            [allow_uploading] => 0
            [share_date] => 
        )

    [4] => Array
        (
            [id] => 95
            [parent_id] => 94
            [dir_name] => Documents
            [size] => 
            [owner_id] => 10
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Documents/
            [shared] => 1
            [comment] => 
            [add_date] =>  07/30/2013 02:38 AM
            [update_date] =>  07/30/2013 02:38 AM
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Documents/
            [trash_status] => 1
            [password] => 123456
            [expires_after] => 5
            [allow_uploading] => 0
            [share_date] => 13-09-2013
        )

    [5] => Array
        (
            [id] => 96
            [parent_id] => 94
            [dir_name] => Music
            [size] => 
            [owner_id] => 10
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Music/
            [shared] => 0
            [comment] => dfdf
            [add_date] =>  07/30/2013 02:38 AM
            [update_date] =>  07/30/2013 02:38 AM
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Music/
            [trash_status] => 1
            [password] => 
            [expires_after] => 0
            [allow_uploading] => 0
            [share_date] => 
        )

    [6] => Array
        (
            [id] => 233
            [parent_id] => 94
            [dir_name] => test
            [size] => 3945040
            [owner_id] => 10
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/test
            [shared] => 0
            [comment] => 
            [add_date] =>  09/06/2013 09:16 AM
            [update_date] =>  09/06/2013 09:16 AM
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/test
            [trash_status] => 1
            [password] => 
            [expires_after] => 0
            [allow_uploading] => 0
            [share_date] => 
        )

)

第二个数组:

Array
(
    [0] => Array
        (
            [id] => 118
            [name] => Desert.jpg
            [size] => 845941
            [type] => image/jpeg
            [ext] => jpg
            [shared] => 1
            [shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home//Desert.jpg
            [comment] => 
            [owner_id] => 10
            [dir_id] => 94
            [path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Desert.jpg
            [del_path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/HomeDesert.jpg
            [dated] =>  09/05/2013 07:15 AM
            [trash_status] => 1
            [password] => 
            [expires_after] => 2
            [share_date] => 06-09-2013
        )

    [1] => Array
        (
            [id] => 120
            [name] => test.zip
            [size] => 4096
            [type] => Zip Archeive
            [ext] => zip
            [shared] => 0
            [shared_link] => /Documentstest.zip
            [comment] => 
            [owner_id] => 10
            [dir_id] => 94
            [path] => /Documentstest.zip
            [del_path] => /Documentstest.zip
            [dated] =>  09/06/2013 09:21 AM
            [trash_status] => 1
            [password] => 
            [expires_after] => 0
            [share_date] => 
        )

)

注意:我想合并两个数组,然后使用foreach循环显示它们,两个数组都有不同的列。

谢谢。请紧急重播。

Note: i want to merge both arrays and after that display them using foreach loop both arrays have different columns.
Thanks. plz urgent replay.

推荐答案

例如合并两个数组

$a = array("red","green","yellow");
$b = array("a","b","c");
$c = array_merge($a,$b);

print_r($c);

foreach ($c as $key => $value) {
    echo $value."<br>";
}

这篇关于合并两个不同的数组,然后使用foreach将它们显示为php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆