3v4l.org

run code in 500+ PHP versions simultaneously
<?php // what i wanna do with this script is for each color, create an array that has the total price(my table has some items that have the same color but with different prices) $a = array(); while($row = mysqli_fetch_assoc($result)) { // create an array of each color, eg: $a["black"] $a["$row[color]"] = array(); // if the price key in the $a["black"] exists then add its value to the new one if(array_key_exists("price", $a["$row[color]"])) { $a["$row[color]"]["price"] += $row["price"]; } else { $a["$row[color]"]["price"] = $row["price"]; } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function mysqli_fetch_assoc() in /in/6NfOm:5 Stack trace: #0 {main} thrown in /in/6NfOm on line 5
Process exited with code 255.

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:
49.8 ms | 1524 KiB | 4 Q