3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array('order' => array('year' => 'desc')); $db_order = $arr['order']; $order_clause = " ORDER BY "; if (!is_array($db_order)) { $db_order = array($db_order); } foreach ($db_order as $num_order => $order_column) { if ($num_order > 0) $order_clause .= ', '; if (!is_array($order_column)) { $order_column = array($order_column => 'ASC'); } $order_key = reset(array_keys($order_column)) $order_clause .= "$order_key $order_column[$order_key]"; } echo $order_clause;
Output for 5.4.0 - 5.4.35
Parse error: syntax error, unexpected '$order_clause' (T_VARIABLE) in /in/vkk41 on line 15
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/vkk41 on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_VARIABLE in /in/vkk41 on line 15
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/vkk41 on line 15
Process exited with code 255.