3v4l.org

run code in 300+ PHP versions simultaneously
<?php function iterate_combined(array $data) { if (!$data) { return []; } $fields = array_keys($data); $n = count(reset($data)); for ($i = 0; $i < $n; ++$i) { $row = []; foreach ($fields as $field) { $row[$field] = $data[$field][$i]; } yield $row; } } $data = [ 'id' => [1, 2, 3], 'title' => ['Первый', 'Впервые мы смогли', 'Перваши'], 'date' => ['2020-11-05 12:51:02', '2020-11-05 15:26:09', '2020-11-03 15:27:26'], 'rating' => [1000, 1212, 111111], 'size' => ['1000 MB', '441 GB', '132 mb'], 'views' => [56252, 1111, 1231] ]; foreach (iterate_combined($data) as $row) { echo json_encode($row, JSON_UNESCAPED_UNICODE), PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
{"id":1,"title":"Первый","date":"2020-11-05 12:51:02","rating":1000,"size":"1000 MB","views":56252} {"id":2,"title":"Впервые мы смогли","date":"2020-11-05 15:26:09","rating":1212,"size":"441 GB","views":1111} {"id":3,"title":"Перваши","date":"2020-11-03 15:27:26","rating":111111,"size":"132 mb","views":1231}

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.45 ms | 402 KiB | 8 Q