php過濾多維陣列,該如何處理

來源:互聯網
上載者:User
php過濾多維陣列
Array (
[0] => Array (
[isxinx] => 1
[rate] => 0.000
[qs] => 177期預測
[cb] => 20
[title] => 【碼到成功】福彩3D177期試機號前信心預測
[id] => 4137166
[userid] => 22843
[childtype] => 試機號前
[mfarticleid] => 0
[author] => 碼到成功
[pubtime] => 2012-07-23 14:18:30
[cptypeid] => 2
[jtpath] =>
[num] => 2
[ltitle] => 曆史成績
[pm] => 10001 )
[1] => Array (
[isxinx] => 1
[rate] => 0.000
[qs] => 177期預測
[cb] => 20
[title] => 【碼到成功】福彩3D177期試機號前信心預測
[id] => 4137166
[userid] => 22843
[childtype] => 試機號前
[mfarticleid] => 0
[author] => 碼到成功
[pubtime] => 2012-07-23 14:18:30
[cptypeid] => 2
[jtpath] =>
[num] => 2
[ltitle] => 曆史成績
[pm] => 10001 ))

我現在就想取qs、cb、title、id、userid、author、ltitle
這七個欄位的資料!請問一下這樣怎麼過濾掉其他的呢

------解決方案--------------------
foreach($arr as $v)
$ar[]=array('qs'=>$v['qs'],...............);

print_r($ar);
------解決方案--------------------
樓上回覆正確!
不過看的數據來源好像是從數據庫中獲取的,最好的方式應該是select的時候把欄位名寫上,而應該避免使用select *
SQL code
select qs,cb,title,id,userid,author,ltitle from table
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.