3v4l.org

run code in 300+ PHP versions simultaneously
<?php // suppose: $pri['base'] = 30000; $pri['com'] = 5000; // then $mst_per_off_base = bcmul($pri['base'],.01); // calculate 1% of the base price $gr[] = bcsub($pri['com'],$mst_per_off_base); // deduct the 1% off of the com echo array_sum($gr); // total of all after deduction

preferences:
27.92 ms | 404 KiB | 5 Q