Use of => in PHP

后端 未结 5 1505
轮回少年
轮回少年 2020-12-17 18:24

What does this mean in PHP and when is the time to use it?

 =>

Another example.

 foreach ($parent as $task_id => $tod         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-17 19:00

    It is used with associative arrays.

    For example,

    $gender = array('male' => 'M', 'female' => 'F');
    

    Where $gender['male'] would give you 'M' and $gender['female'] will give you 'F'.

提交回复
热议问题