3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fee($amount) { $ourFeePct = .05; // %5 $stripeFeePct = .029; // 2.9% $stripeFeeFixed = 30; //30 cents $ourFee = (int) $amount * $ourFeePct; //5 cents on the dollar. $total = (int) ($amount + $ourFee + $stripeFeeFixed) /(1 - $stripeFeePct); $stripe = ($total - $amount) - $ourFee;//stripes cut return [$ourFee,$total,$stripe]; } $amt = 5000; // $50 in cents. list($fee,$total,$stripe) = fee($amt); printf('amount to be paid to user B %d'.PHP_EOL,$amt); printf('amount to be charged to user A %d'.PHP_EOL,$total); printf('our cut %d'.PHP_EOL,$fee); printf('stripes cut %d'.PHP_EOL,$stripe);
Output for git.master, git.master_jit, rfc.property-hooks
amount to be paid to user B 5000 amount to be charged to user A 5437 our cut 250 stripes cut 187

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:
44.48 ms | 1504 KiB | 4 Q