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") ); ?> 

http://php.net/manual/en/function.array.php


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -