PHP VERSION: 7.0.22

list_changes_access_all_offsets.php

<?php 
// changes to list()

foreach (range(02) as $key) {
    
$array[$key] = range('A''C');
}

list(list(
$a$b$c$d$e)) = $array;

var_dump($array);
var_dump($a$b);
 
// OLD:
//$b = $array[0][1];
//$a = $array[0][0];
 
// NEW:
//$_tmp = $array[0];
//$a = $_tmp[0];
//$b = $_tmp[1];

Output


array(3) {
  [0]=>
  array(3) {
    [0]=>
    string(1) "A"
    [1]=>
    string(1) "B"
    [2]=>
    string(1) "C"
  }
  [1]=>
  array(3) {
    [0]=>
    string(1) "A"
    [1]=>
    string(1) "B"
    [2]=>
    string(1) "C"
  }
  [2]=>
  array(3) {
    [0]=>
    string(1) "A"
    [1]=>
    string(1) "B"
    [2]=>
    string(1) "C"
  }
}
string(1) "A"
string(1) "B"
SOURCE CODE