3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = array('Muziek' => 'Brahms', 'DVD' => 'Rambo', 'Blueray' => 'Mozart'); $new_products = array(); foreach ($products as $key => $value){ //echo 'The value of '.$key.' is '.$value.'<br />'; // The value of Muziek is Brahms, etc $new_products[$key] = $value; //$new_products[] = array($key => $value); // multidimensional array met in elke array (2e) 1 name value pair //$new_products[] = array($key => $value, $value => $key ); // multidimensional array met in elke array (2e) een name value pair en dus een value name pair } echo '<pre>';print_r($products);
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [Muziek] => Brahms [DVD] => Rambo [Blueray] => Mozart )

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