3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(74.6779,25.918,44.9589); $total = array_sum($arr); $total_percentage = 0; ini_set('precision',100); foreach($arr as $total_item) { $percentage = ($total_item*100)/$total; var_dump($percentage); $percentage = round($percentage,2); // without this works, but result large numbers.. e.g: "51.305693800548" echo $percentage; echo "\n"; $total_percentage = round($total_percentage+$percentage,2); } echo round($total_percentage,1);
Output for git.master, git.master_jit, rfc.property-hooks
float(51.305693800547964) 51.31000000000000227373675443232059478759765625 float(17.806351971903364) 17.809999999999998721023075631819665431976318359375 float(30.887954227548665) 30.8900000000000005684341886080801486968994140625 100

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:
57.5 ms | 401 KiB | 8 Q