Assign array element to variable in PHP

后端 未结 3 1628
野的像风
野的像风 2021-01-24 10:14

I know this is a silly question, but i\'m stucked! I have the following array:

Array ( [type] => 8 [message] => Use of undefined constant hola - assumed \'         


        
3条回答
  •  孤街浪徒
    2021-01-24 11:09

    It's an associative array and you need to access elements by key. In your case:

    $var = $array['message'];
    

提交回复
热议问题