3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [['range' => 336, 'year' => 2020],['range' => 336, 'year' => 2020],['range' => 390, 'year' => 2020],['range' => 390, 'year' => 2021]]; $idList = array_flip(array_values(array_unique(array_column($array, 'range')))); $newDatesCurrent = []; foreach($array as $value) { $newDatesCurrent[] = ['range' => $idList[$value['range']], 'year' => $value['year'], 'month' => 222]; } print_r($newDatesCurrent);
Output for 7.0.33, 8.1.23 - 8.1.33, 8.2.10 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
Array ( [0] => Array ( [range] => 0 [year] => 2020 [month] => 222 ) [1] => Array ( [range] => 0 [year] => 2020 [month] => 222 ) [2] => Array ( [range] => 1 [year] => 2020 [month] => 222 ) [3] => Array ( [range] => 1 [year] => 2021 [month] => 222 ) )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
125.18 ms | 407 KiB | 5 Q