3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $conditions = unserialize("a:4:{i:0;a:3:{s:5:"field";s:14:" year_of_entry";s:9:"condition";s:1:"=";s:5:"value";s:4:"2015";}i:1;a:3:{s:5:"field";s:6:"status";s:9:"condition";s:1:"=";s:5:"value";s:2:"UF";}i:2;a:3:{s:5:"field";s:17:" initial_decision";s:9:"condition";s:1:"=";s:5:"value";s:1:"U";}i:3;a:3:{s:5:"field";s:12:" last_status";s:9:"condition";s:2:"!=";s:5:"value";s:2:"UI";}}"); if (is_array($conditions)) { foreach ($conditions as $c) { $parts = explode('.', $c['field']); if (count($parts) == 1) { $c['field'] = 'Application.'.trim($c['field']); } switch ($c['condition']) { case '=': $key = $c['field']; $criteria[$key] = $c['value']; break; case '!=': $key = $c['field'] . ' ' . $c['condition']; $criteria[$key] = $c['value']; break; case 'in': $key = $c['field']; $values = explode(',', $c['value']); foreach ($values as $k => $v) { $values[$k] = trim($v); } $criteria[$key] = $values; break; } } } //check the database adding the recent records id to the array $criteria['Application.id'] = 1; var_dump($criteria);
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected 'field' (T_STRING) in /in/RFBvs on line 3
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_STRING in /in/RFBvs on line 3
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_STRING in /in/RFBvs on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/RFBvs on line 3
Process exited with code 255.