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; foreach($arr as $total_item) { $percentage = ($total_item*100)/$total; //$percentage = round($percentage,2); // without this works, but result echo $percentage; echo "\n"; $total_percentage+=$percentage; } echo $total_percentage;
Output for git.master, git.master_jit, rfc.property-hooks
51.305693800548 17.806351971903 30.887954227549 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:
38.48 ms | 401 KiB | 8 Q