3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php funtion sales_search($arr, $needle) { foreach ($arr as $id => $data) { if (in_array($needle, $data['states'])) { return $id; } if (in_array($needle, $data['codes'])) { return $id; } } return false; } $sales_people = array( '2' => array( 'states' => array('NY', 'NJ', 'CT', 'MA', 'VT', 'ME'), 'codes' => array('CA1', 'US7', 'UT9') ), '5' => array( 'states' => array('FL', 'GA', 'SC', 'NC', 'TN'), 'codes' => array('VA4', 'VA8', 'VA3') ) ); var_dump(sales_search($sales_people, 'VA4'));
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected 'sales_search' (T_STRING) in /in/g9rKU on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/g9rKU on line 2
Process exited with code 255.