php - Elements in array without keys mixed with elements with keys -
i've stumbled upon function today:
public function rules() { return [ ['status', 'default', 'value' => self::status_active], ['status', 'in', 'range' => [self::status_active, self::status_deleted]], ]; }
i don't understand construction:
['status', 'default', 'value' => self::status_active]
how's first 2 entries have value, , third has key , value. php language allows?
this nothing new. key optional. can find similar case in first example of php documentation arrays.
here is.
<?php $fruits = array ( "fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"), "numbers" => array(1, 2, 3, 4, 5, 6), "holes" => array("first", 5 => "second", "third") ); ?>
Comments
Post a Comment