Can items in PHP associative arrays not be accessed numerically (i.e. by index)?

后端 未结 6 1652
清酒与你
清酒与你 2021-01-06 08:26

I\'m trying to understand why, on my page with a query string, the code:

echo \"Item count = \" . count($_GET);
echo \"First item = \" . $_         


        
6条回答
  •  执念已碎
    2021-01-06 08:57

    You can do it this way:

    $keys = array_keys($_GET);
    
    echo "First item = " . $_GET[$keys[0]];
    

提交回复
热议问题