3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rates = array( 'apple' => array( 'red' => array( 'rate' => 1.19, 'resume' => 'This is a red apple.' ), 'green' => array( 'rate' => 0.99, 'resume' => 'This is a green apple.' ), 'yellow' => array( 'rate' => 0.89, 'resume' => 'This is a yellow apple.' ), ) ); $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]['rate'][$value] ?? 0; } } } echo $total;
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "red" in /in/vsEvA:22 Stack trace: #0 {main} thrown in /in/vsEvA on line 22
Process exited with code 255.

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