3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [['value' => 1100], ['value' => 1000], ['value' => 3000]], [['value' => 1200], ['value' => 2000], ['value' => 2000]], [['value' => 1300], ['value' => 4000], ['value' => 1000]], ]; var_export( array_map(fn(...$col) => $col, ...$array) // to demonstrate transposition ); echo "\n---\n"; var_export( array_map( fn(...$col) => array_sum(array_column($col, 'value')), ...$array ) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 0 => array ( 'value' => 1100, ), 1 => array ( 'value' => 1200, ), 2 => array ( 'value' => 1300, ), ), 1 => array ( 0 => array ( 'value' => 1000, ), 1 => array ( 'value' => 2000, ), 2 => array ( 'value' => 4000, ), ), 2 => array ( 0 => array ( 'value' => 3000, ), 1 => array ( 'value' => 2000, ), 2 => array ( 'value' => 1000, ), ), ) --- array ( 0 => 3600, 1 => 7000, 2 => 6000, )

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