3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rates = array( 'apple' => array( 'red' => 1.19, 'green' => 0.99, 'yellow' => 0.89 ) ); $cart = array( 'apple' => array( '0' => 'red', '1' => 'green' ) ); $total = 0; foreach ($cart as $key => $arr) { if (isset($rates[$key])) { foreach ($arr as $value) { $total += $rates[$key][$value] ?? 0; } } } echo $total;
Output for git.master, git.master_jit, rfc.property-hooks
2.18

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:
31.09 ms | 405 KiB | 5 Q