PHP個人筆記,陣列相關

* 陣列宣告

    $rows = array();

*取得陣列長度

    $rowscount=count($rows);

*陣列顛倒
    $rows = array_reverse($rows);


*在二維陣列內搜尋特定得值,在哪個key
    $key = array_search("ABC",array_column($rows,'type'));
    echo "Key值為:".$key;


*打印陣列資訊
    print_r($rows);
    
    var_dump($rows);

*json轉陣列
$rows=json_decode($jsonstr,true);


留言

此網誌的熱門文章