3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('protein' => 'proteiny', 'total_fat' => 'total faty', 'carbohydrates' => 'carbohydrates', 'food_energy' => 'food energy'); $b = array('protein' => 'grams', 'total_fat' => 'grams', 'carbohydrates' => 'grams', 'food_energy' => 'kcals'); $newone = array_map(function($val, $slug) use ($b) { return ['slug' => $slug, 'name' => $val, 'format' => $b[$slug]]; }, $a, array_keys($a)); print_r($newone);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [slug] => protein [name] => proteiny [format] => grams ) [1] => Array ( [slug] => total_fat [name] => total faty [format] => grams ) [2] => Array ( [slug] => carbohydrates [name] => carbohydrates [format] => grams ) [3] => Array ( [slug] => food_energy [name] => food energy [format] => kcals ) )

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:
166.85 ms | 407 KiB | 5 Q