3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myarray = array(array( "TICKETPRICE" => "6.0000", "QUANTITY" => "2", "COUNTRYID" => "15" ), array( "TICKETPRICE" => "4.0000", "QUANTITY" => "3", "COUNTRYID" => "9" )); $output = array(); foreach ($myarray as $array) { $qty = $array['QUANTITY']; unset($array['QUANTITY']); $output[] = array_fill(0, $qty, $array); } echo json_encode($output) . "\n"; $output = array(); foreach ($myarray as $array) { $qty = $array['QUANTITY']; unset($array['QUANTITY']); $output = array_merge($output, array_fill(0, $qty, $array)); } echo json_encode($output);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
169.43 ms | 2082 KiB | 13 Q