In php array => represents the connector between the array key name and the element. Simply put, the => symbol is used to separate keys and values. The left side represents the key and the right side represents the value.
The operating environment of this tutorial: Windows 10 system, PHP8.1.3 version, Dell G3 computer.
=> in php is generally used as a connector between array keys and elements. Simply put, the => symbol is used to separate keys and values. The left side represents the key and the right side represents the value.
For example:
$arr = array( 'a'=>'123', 'b'=>'456' ); foreach($arr as $key=>$val){ //$key是数组键名 //$val是数组键名对应的值 }
Commonly used array operators
: Merge arrays. If the key names are the same, only the keys of the left array will be displayed. Value pair;
==: Compare the key name of the array and the corresponding key value. If they are the same, return true, otherwise return false;
===: Compare the key name and the corresponding key value. Whether the key values and key value types are the same, and the order must be the same;
!=: Compare the key names of the array and the corresponding key values are different;
!==: Compare the array key names Whether the key name and the corresponding key value and key value type are different, or the order is different;
<>: The effect is the same as !=
The above is the detailed content of What does => mean in php array. For more information, please follow other related articles on the PHP Chinese website!