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);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
207.96 ms | 2129 KiB | 12 Q