Как разобраться с многомерным двумерным массивом?

Получаю массив данных
$array = array();

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://shikimori.org/api/animes/27833/screenshots');
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "User Agent");
    if ($content = curl_exec($ch)) {
      $array = json_decode($content, true);
    }
    curl_close($ch);

Массив приходит в виде:
Array
(
    [0] => Array
        (
            [original] => /images/screenshot/original/2c47905649908b6c865a7f5a0b90633611cecb50.jpg?1452457649
            [preview] => /images/screenshot/x332/2c47905649908b6c865a7f5a0b90633611cecb50.jpg?1452457649
        )

    [1] => Array
        (
            [original] => /images/screenshot/original/1dd1486adb009f646831ff28cf797ebfd7830aee.jpg?1452457649
            [preview] => /images/screenshot/x332/1dd1486adb009f646831ff28cf797ebfd7830aee.jpg?1452457649
        )

    [2] => Array
        (
            [original] => /images/screenshot/original/79e0fa6957a010e44380b82cd136868f07966629.jpg?1452457650
            [preview] => /images/screenshot/x332/79e0fa6957a010e44380b82cd136868f07966629.jpg?1452457650
        )

    [3] => Array
        (
            [original] => /images/screenshot/original/ce9317a4d2bfa7a59fe6b23a0600804ba6fccbed.jpg?1452457651
            [preview] => /images/screenshot/x332/ce9317a4d2bfa7a59fe6b23a0600804ba6fccbed.jpg?1452457651
        )

    [4] => Array
        (
            [original] => /images/screenshot/original/9bf2406a20256a2f9ffa19056d4bdf37d1052938.jpg?1452457652
            [preview] => /images/screenshot/x332/9bf2406a20256a2f9ffa19056d4bdf37d1052938.jpg?1452457652
        )

    [5] => Array
        (
            [original] => /images/screenshot/original/50d20392f5857520497499d616eab52c122e7370.jpg?1452457654
            [preview] => /images/screenshot/x332/50d20392f5857520497499d616eab52c122e7370.jpg?1452457654
        )

    [6] => Array
        (
            [original] => /images/screenshot/original/54a7414d55f70ed0f519d96053707de8abbee90f.jpg?1452457656
            [preview] => /images/screenshot/x332/54a7414d55f70ed0f519d96053707de8abbee90f.jpg?1452457656
        )

    [7] => Array
        (
            [original] => /images/screenshot/original/d77a38dd23d29a079c42f712291361cea674255c.jpg?1452457658
            [preview] => /images/screenshot/x332/d77a38dd23d29a079c42f712291361cea674255c.jpg?1452457658
        )

    [8] => Array
        (
            [original] => /images/screenshot/original/7fff06c4c810299d0b76ae3af426fd6bbcbabe8a.jpg?1452457660
            [preview] => /images/screenshot/x332/7fff06c4c810299d0b76ae3af426fd6bbcbabe8a.jpg?1452457660
        )

    [9] => Array
        (
            [original] => /images/screenshot/original/dc849e1cf5a3cdfbaf32dfbf6f23b68e147f7ed5.jpg?1452457662
            [preview] => /images/screenshot/x332/dc849e1cf5a3cdfbaf32dfbf6f23b68e147f7ed5.jpg?1452457662
        )

    [10] => Array
        (
            [original] => /images/screenshot/original/39749597aa2ad8a6613da4b1ca16dff3357b9e0a.jpg?1452457664
            [preview] => /images/screenshot/x332/39749597aa2ad8a6613da4b1ca16dff3357b9e0a.jpg?1452457664
        )

    [11] => Array
        (
            [original] => /images/screenshot/original/083b350f6f0842513bb188f5f10229f8bba3153b.jpg?1452457666
            [preview] => /images/screenshot/x332/083b350f6f0842513bb188f5f10229f8bba3153b.jpg?1452457666
        )

    [12] => Array
        (
            [original] => /images/screenshot/original/a89a54b1c4d26dd2d0e365d263bd02ebf7d1a980.jpg?1452457669
            [preview] => /images/screenshot/x332/a89a54b1c4d26dd2d0e365d263bd02ebf7d1a980.jpg?1452457669
        )

    [13] => Array
        (
            [original] => /images/screenshot/original/d1f61711de95c797eb3202ec089d573d0b0c1798.jpg?1452457671
            [preview] => /images/screenshot/x332/d1f61711de95c797eb3202ec089d573d0b0c1798.jpg?1452457671
        )

    [14] => Array
        (
            [original] => /images/screenshot/original/29836be83b4886d0e6aefebcb9552b69b8a756d4.jpg?1452457672
            [preview] => /images/screenshot/x332/29836be83b4886d0e6aefebcb9552b69b8a756d4.jpg?1452457672
        )

    [15] => Array
        (
            [original] => /images/screenshot/original/e44f2f508cebe9fd5e9adb2c3a1c62fed7e76bb0.jpg?1452457674
            [preview] => /images/screenshot/x332/e44f2f508cebe9fd5e9adb2c3a1c62fed7e76bb0.jpg?1452457674
        )

    [16] => Array
        (
            [original] => /images/screenshot/original/895443cb077c35a9364332fec7eb445e72eee9cf.jpg?1452457675
            [preview] => /images/screenshot/x332/895443cb077c35a9364332fec7eb445e72eee9cf.jpg?1452457675
        )

    [17] => Array
        (
            [original] => /images/screenshot/original/ec0c4229b23a336db82698a3668d5cc7fabdf7b1.jpg?1452457676
            [preview] => /images/screenshot/x332/ec0c4229b23a336db82698a3668d5cc7fabdf7b1.jpg?1452457676
        )

    [18] => Array
        (
            [original] => /images/screenshot/original/f8b79a3ce232b5af1cabb94da8b702945e06a137.jpg?1452457678
            [preview] => /images/screenshot/x332/f8b79a3ce232b5af1cabb94da8b702945e06a137.jpg?1452457678
        )

    [19] => Array
        (
            [original] => /images/screenshot/original/9a09cfe43735ce75dbd24748db2f4d23466b1b60.jpg?1452457679
            [preview] => /images/screenshot/x332/9a09cfe43735ce75dbd24748db2f4d23466b1b60.jpg?1452457679
        )

    [20] => Array
        (
            [original] => /images/screenshot/original/f8e38da1457db071b226c2c7985f9013b9c1c3fb.jpg?1452457680
            [preview] => /images/screenshot/x332/f8e38da1457db071b226c2c7985f9013b9c1c3fb.jpg?1452457680
        )

    [21] => Array
        (
            [original] => /images/screenshot/original/b84dcddc565c7291fe39860251037c8f77721514.jpg?1452457681
            [preview] => /images/screenshot/x332/b84dcddc565c7291fe39860251037c8f77721514.jpg?1452457681
        )

    [22] => Array
        (
            [original] => /images/screenshot/original/f528eabb2ca8e1e0bff3aa95bb6752420c380084.jpg?1452457682
            [preview] => /images/screenshot/x332/f528eabb2ca8e1e0bff3aa95bb6752420c380084.jpg?1452457682
        )

    [23] => Array
        (
            [original] => /images/screenshot/original/95af6924aaf9edbb36fc707f16ff4d4ef29f3720.jpg?1452457682
            [preview] => /images/screenshot/x332/95af6924aaf9edbb36fc707f16ff4d4ef29f3720.jpg?1452457682
        )

    [24] => Array
        (
            [original] => /images/screenshot/original/1767f920efaf2f1920de810e3f9a429405981e19.jpg?1452457683
            [preview] => /images/screenshot/x332/1767f920efaf2f1920de810e3f9a429405981e19.jpg?1452457683
        )

    [25] => Array
        (
            [original] => /images/screenshot/original/20ad3a9f6a17d518e1507f3714bebe46ad7362d0.jpg?1452457684
            [preview] => /images/screenshot/x332/20ad3a9f6a17d518e1507f3714bebe46ad7362d0.jpg?1452457684
        )

    [26] => Array
        (
            [original] => /images/screenshot/original/1e2f33e54058826cadbae7a3049c89c06eb59929.jpg?1452457685
            [preview] => /images/screenshot/x332/1e2f33e54058826cadbae7a3049c89c06eb59929.jpg?1452457685
        )

    [27] => Array
        (
            [original] => /images/screenshot/original/c21d06bf130564edb507ac6f3fd108664a1f172e.jpg?1452457686
            [preview] => /images/screenshot/x332/c21d06bf130564edb507ac6f3fd108664a1f172e.jpg?1452457686
        )

    [28] => Array
        (
            [original] => /images/screenshot/original/599de83116cb391d2b7cd7fdc27704d3f9231b54.jpg?1452457687
            [preview] => /images/screenshot/x332/599de83116cb391d2b7cd7fdc27704d3f9231b54.jpg?1452457687
        )

    [29] => Array
        (
            [original] => /images/screenshot/original/1fcb3828bcd0a7b52e6205dc61efb2b28517cb70.jpg?1452457689
            [preview] => /images/screenshot/x332/1fcb3828bcd0a7b52e6205dc61efb2b28517cb70.jpg?1452457689
        )

    [30] => Array
        (
            [original] => /images/screenshot/original/c966b4e20a0433b3f4782867dd9df94fc721825c.jpg?1452457690
            [preview] => /images/screenshot/x332/c966b4e20a0433b3f4782867dd9df94fc721825c.jpg?1452457690
        )

    [31] => Array
        (
            [original] => /images/screenshot/original/9646801df8356850b4fd459cd163aff7cb1b28ea.jpg?1452457691
            [preview] => /images/screenshot/x332/9646801df8356850b4fd459cd163aff7cb1b28ea.jpg?1452457691
        )

    [32] => Array
        (
            [original] => /images/screenshot/original/6aa2b09c6b475e2d54b90c8923283e679df7f8b5.jpg?1452457692
            [preview] => /images/screenshot/x332/6aa2b09c6b475e2d54b90c8923283e679df7f8b5.jpg?1452457692
        )

)

Как получить список только [original]
По сабжу сразу вопрос [1],[2],[3] и т.д может быть неограниченным
Также интересует как список только [original] можно забить в базу?
  • Вопрос задан
  • 322 просмотра
Решения вопроса 1
riky
@riky
Laravel
если php >= 5.5
то
$result = array_column($array, 'original');

если меньше то можно использовать любые заменители из комментов
php.net/manual/ru/function.array-column.php
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы