3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatMap (array $array, callable $function): array { $output = []; foreach ($array as $value) { $tmp = $function($value); foreach ($tmp as $row) { $output[] = $row; } } return $output; } $example = [ ['schools' => '001|002|003'], ['schools' => '004|005|006'], ['schools' => '007|008|009'], ]; print_r( flatMap($example, function ($record) { return explode('|', $record['schools']); }) );
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 001 [1] => 002 [2] => 003 [3] => 004 [4] => 005 [5] => 006 [6] => 007 [7] => 008 [8] => 009 )

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:
44.65 ms | 401 KiB | 8 Q