3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weights = [1, 100, 111, 168, 569, 1652, 16549, 19999, 20000, 20001, 25649, 35216, 54961]; foreach($weights as $index => $weight) { $extra_weight = round($weight-20000, 3)/1000; $extra_cost = $extra_weight * 1.00; echo "Method 1: Weight= $weight , Extra Weight: $extra_weight \n"; echo "Method 1: Weight= $weight , Extra Cost: $extra_weight \n"; $extra_weight = round(($weight-20000)/1000, 0); $extra_cost = $extra_weight * 1.00; echo "Method 2: Weight= $weight , Extra Weight: $extra_weight \n"; echo "Method 2: Weight= $weight , Extra Cost: $extra_weight \n"; } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Method 1: Weight= 1 , Extra Weight: -19.999 Method 1: Weight= 1 , Extra Cost: -19.999 Method 2: Weight= 1 , Extra Weight: -20 Method 2: Weight= 1 , Extra Cost: -20 Method 1: Weight= 100 , Extra Weight: -19.9 Method 1: Weight= 100 , Extra Cost: -19.9 Method 2: Weight= 100 , Extra Weight: -20 Method 2: Weight= 100 , Extra Cost: -20 Method 1: Weight= 111 , Extra Weight: -19.889 Method 1: Weight= 111 , Extra Cost: -19.889 Method 2: Weight= 111 , Extra Weight: -20 Method 2: Weight= 111 , Extra Cost: -20 Method 1: Weight= 168 , Extra Weight: -19.832 Method 1: Weight= 168 , Extra Cost: -19.832 Method 2: Weight= 168 , Extra Weight: -20 Method 2: Weight= 168 , Extra Cost: -20 Method 1: Weight= 569 , Extra Weight: -19.431 Method 1: Weight= 569 , Extra Cost: -19.431 Method 2: Weight= 569 , Extra Weight: -19 Method 2: Weight= 569 , Extra Cost: -19 Method 1: Weight= 1652 , Extra Weight: -18.348 Method 1: Weight= 1652 , Extra Cost: -18.348 Method 2: Weight= 1652 , Extra Weight: -18 Method 2: Weight= 1652 , Extra Cost: -18 Method 1: Weight= 16549 , Extra Weight: -3.451 Method 1: Weight= 16549 , Extra Cost: -3.451 Method 2: Weight= 16549 , Extra Weight: -3 Method 2: Weight= 16549 , Extra Cost: -3 Method 1: Weight= 19999 , Extra Weight: -0.001 Method 1: Weight= 19999 , Extra Cost: -0.001 Method 2: Weight= 19999 , Extra Weight: -0 Method 2: Weight= 19999 , Extra Cost: -0 Method 1: Weight= 20000 , Extra Weight: 0 Method 1: Weight= 20000 , Extra Cost: 0 Method 2: Weight= 20000 , Extra Weight: 0 Method 2: Weight= 20000 , Extra Cost: 0 Method 1: Weight= 20001 , Extra Weight: 0.001 Method 1: Weight= 20001 , Extra Cost: 0.001 Method 2: Weight= 20001 , Extra Weight: 0 Method 2: Weight= 20001 , Extra Cost: 0 Method 1: Weight= 25649 , Extra Weight: 5.649 Method 1: Weight= 25649 , Extra Cost: 5.649 Method 2: Weight= 25649 , Extra Weight: 6 Method 2: Weight= 25649 , Extra Cost: 6 Method 1: Weight= 35216 , Extra Weight: 15.216 Method 1: Weight= 35216 , Extra Cost: 15.216 Method 2: Weight= 35216 , Extra Weight: 15 Method 2: Weight= 35216 , Extra Cost: 15 Method 1: Weight= 54961 , Extra Weight: 34.961 Method 1: Weight= 54961 , Extra Cost: 34.961 Method 2: Weight= 54961 , Extra Weight: 35 Method 2: Weight= 54961 , Extra Cost: 35

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:
45.83 ms | 409 KiB | 8 Q