How to output the value of a specific key name in a two-dimensional array

Source: Internet
Author: User
How to output the value of a specific key name in a two-dimensional array
$url = ' http://quotes.money.163.com/hs/service/marketradar_ajax.php?page=0&query=STYPE%3AEQA&types= Jhjjfl&count=28&type=query ';
Match page number
$file =json_decode (file_get_contents ($url), true);
$out = $file [' list '];
$pageCount = (int) $file [' PageCount '];
Get the stock code for each page and put it in the appropriate array
for ($q =1; $q < $pageCount; $q + +) {
$url = ' http://quotes.money.163.com/hs/service/marketradar_ajax.php?page= '. $q. ' &query=stype%3aeqa&types= Jhjjfl&count=28&type=query ';
$file =json_decode (file_get_contents ($url), true);
foreach ($file [' list '] as $v) $out []= $v;
}
Var_export ($out);

How do I output a stock code with all the keys in the $out array named ' SYMBOL ' and put it in a new one-dimensional array

------Solution--------------------
PHP Code
$SYMBOLList = Array ();//container for ($q =1; $q < $pageCount; $q + +) {    $url = ' http://quotes.money.163.com/hs/service/ Marketradar_ajax.php?page= '. $q. ' &query=stype%3aeqa&types=jhjjfl&count=28&type=query ';    $file =json_decode (file_get_contents ($url), true);    foreach ($file [' list '] as $v) {        $out []= $v;        echo $v [' SYMBOL ']; can be output directly        $SYMBOLList [] = $v [' SYMBOL '];//after the array is saved}    }
------Solution--------------------
function Get_symbol ($ar) {
return $ar [' SYMBOL '];
}

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.