rfc:array_part

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:array_part [2012/05/28 13:31] – [Changelog] cataphractrfc:array_part [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 3: Line 3:
   * Date: 2012-05-14   * Date: 2012-05-14
   * Author: Gustavo Lopes <cataphract@php.net>   * Author: Gustavo Lopes <cataphract@php.net>
-  * Status: Under Discussion+  * Status: Declined
   * First Published at: http://wiki.php.net/rfc/array_part   * First Published at: http://wiki.php.net/rfc/array_part
  
Line 25: Line 25:
 Each part specification shall have one of the following forms: Each part specification shall have one of the following forms:
  
-  * A sequential numeric array of indexes, which specifies that only the elements existing at those indexes will be kept.+  * A non-empty sequential numeric array of indexes, which specifies that only the elements existing at those indexes will be kept.
   * A single index, which specifies that only the element existing at that index will be kept. In this case the level will be collapsed onto the previous one, meaning all the arrays at that level will be replaced with its element the specified index.   * A single index, which specifies that only the element existing at that index will be kept. In this case the level will be collapsed onto the previous one, meaning all the arrays at that level will be replaced with its element the specified index.
   * A span part specification is an associative array. The following keys are allowed //start//, //end// and //step//. At least //start// or //end// must be specified. //start// and //end// are an index or a special value -- ''null''. //step// is a non-zero integer, defaulting to ''1''. If ''start'' or ''end'' are not specified, they default to ''null'', which refer to either the first or last element depending on the sign of //step//. If //step// is +-1 and //start// and //end// are both ''null'' (or, if ''$indexesAreKeys'' is ''false'', //start// and //end// are //0// and //-1// or vice-versa depending on the sign of //step//), then we say the span encompasses all elements on that level (possibly 0).   * A span part specification is an associative array. The following keys are allowed //start//, //end// and //step//. At least //start// or //end// must be specified. //start// and //end// are an index or a special value -- ''null''. //step// is a non-zero integer, defaulting to ''1''. If ''start'' or ''end'' are not specified, they default to ''null'', which refer to either the first or last element depending on the sign of //step//. If //step// is +-1 and //start// and //end// are both ''null'' (or, if ''$indexesAreKeys'' is ''false'', //start// and //end// are //0// and //-1// or vice-versa depending on the sign of //step//), then we say the span encompasses all elements on that level (possibly 0).
rfc/array_part.1338211873.txt.gz · Last modified: 2017/09/22 13:28 (external edit)