3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $products = [1, 2, 3, 4, 5]; $vendors = ["Amazon", "Newegg", "##php"]; // Super complex price calculator function getPrice($vendor, $product) { return rand(0, 100); } $productsCalculated = []; foreach ($products as $productID) { $prices = []; foreach ($vendors as $vendor) { $prices[$vendor] = getPrice($vendor, $product); } } var_dump($productsCalculated)
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected end of file in /in/MDPd1 on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/MDPd1 on line 3
Process exited with code 255.