ご覧いただきありがとうございます。
php
1array ( 36 => array ( 0 => array ( 'poll_one' => 'test1', 0 => 'test1', 'poll_two' => 'test2', 1 => 'test2', 'poll_three' => 'test3', 2 => 'test3', 'poll_four' => 'test4', 3 => 'test4', 'poll_five' => 'test5', 4 => 'test5', 'poll_six' => 'test6', 5 => 'test6', 'poll_seven' => 'test7', 6 => 'test7', 'poll_eight' => 'test8', 7 => 'test8', ), ), 37 => array ( 0 => array ( 'poll_one' => 'test2-1', 0 => 'test2-1', 'poll_two' => 'test2-2', 1 => 'test2-2', 'poll_three' => 'test2-3', 2 => 'test2-3', 'poll_four' => 'test2-4', 3 => 'test2-4', 'poll_five' => 'test2-5', 4 => 'test2-5', 'poll_six' => 'test2-6', 5 => 'test2-6', 'poll_seven' => 'test2-7', 6 => 'test2-7', 'poll_eight' => 'test2-8', 7 => 'test2-8', ), ), )
上記のような配列があり、idが36,37の配列があるのですが、idが36の配列だけを抜き出して新たに配列を作り変えることはできるのでしょうか?
php
1foreach ($polls as $poll => $values) { 2 if($poll==36){ 3 print_r($poll); //表示結果36 4 } 5}
このprint_rの部分で作り変えれる構文などありましたらご教授ください。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/10/13 09:53