3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array=[ ['Name','Email','Phone Number'], ['Mick','mick@mick.com','01234 324234'], ['james','james@james.com',''], ['reg','reg@reg.com','10293 467289'] ]; foreach($array as $index=>$item){ if(!$index){ $result[]=['Name','Info']; }else{ $result[]=[$item[0],$item[1].(strlen($item[2])?" + $item[2]":'')]; } } var_export($result); echo "\n\n---\n\n"; var_export( array_map(function($index,$item){ if(!$index){ return ['Name','Info']; }else{ return [$item[0],$item[1].(strlen($item[2])?" + $item[2]":'')]; } },array_keys($array),$array) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 0 => 'Name', 1 => 'Info', ), 1 => array ( 0 => 'Mick', 1 => 'mick@mick.com + 01234 324234', ), 2 => array ( 0 => 'james', 1 => 'james@james.com', ), 3 => array ( 0 => 'reg', 1 => 'reg@reg.com + 10293 467289', ), ) --- array ( 0 => array ( 0 => 'Name', 1 => 'Info', ), 1 => array ( 0 => 'Mick', 1 => 'mick@mick.com + 01234 324234', ), 2 => array ( 0 => 'james', 1 => 'james@james.com', ), 3 => array ( 0 => 'reg', 1 => 'reg@reg.com + 10293 467289', ), )

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