3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tables = [ [ 'key1' => 'value1', 'key2' => 'value2' ], [ 'key3' => 'value3', 'key4' => 'value4' ], ]; echo 'List Each' . \PHP_EOL; foreach ($tables as $table_array) { list(,$table) = each($table_array); var_dump($table); } echo \PHP_EOL; echo 'Array Shift'. \PHP_EOL; foreach ($tables as $table_array) { $table = array_shift($table_array); var_dump($table); } echo \PHP_EOL; echo 'Current Next' . \PHP_EOL; foreach ($tables as $table_array) { $table = current($table_array); var_dump($table); next($table_array); } echo \PHP_EOL; echo 'Current Next w/key' . \PHP_EOL; foreach ($tables as $table_array) { $key = key($table_array); $table = current($table_array); var_dump($key, $table); next($table_array); }

preferences:
16.19 ms | 402 KiB | 5 Q