<?php
$rows = array_fill(0, 3, array_fill('a', 'z', 'value'));
print_r($value);die;
$start1 = microtime(true);
for ($i = 0; $i < 10000; ++$i) {
$data = array_column($array, 0);
}
$end1 = microtime(true);
echo 'array_column: ', $end1 - $start1, "\n";
$start2 = microtime(true);
for ($i = 0; $i < 10000; ++$i) {
$data = array();
foreach ($array as $r) {
$data[] = $r[0];
}
}
$end2 = microtime(true);
echo 'foreach: ', $end2 - $start2, "\n";
- Output for 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
- Warning: array_fill() expects parameter 1 to be int, string given in /in/oGXlZ on line 3
Notice: Undefined variable: value in /in/oGXlZ on line 4
- Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26
- Warning: array_fill() expects parameter 1 to be integer, string given in /in/oGXlZ on line 3
Notice: Undefined variable: value in /in/oGXlZ on line 4
- Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
- Warning: array_fill() expects parameter 1 to be long, string given in /in/oGXlZ on line 3
Notice: Undefined variable: value in /in/oGXlZ on line 4
preferences:
139.07 ms | 402 KiB | 196 Q