3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $fo = new \SplFileObject('import_mmt_20140701.csv', 'r'); $processedBrands = []; $processedModels = []; $lastBrand = ''; foreach ($fo as $line) { isset($i) ? ++$i : $i = 0; if ($i === 0) continue; if (empty($line)) continue; // Countries (assume country names are already converted to the correct ones): list($countryName, $description, $name) = str_getcsv($line, ';'); $countryName = trim($countryName); $description = trim($description); $name = trim($name); if (!in_array($name, $processedBrands) && !empty($countryName) && !empty($name)) { save_brand([ 'status' => 1, 'country' => $countryName, 'countryId' => item_country($countryName), 'reference' => str_url($name), 'name' => $name, 'description' => $description ]); $processedBrands[] = $name; } }
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught RuntimeException: SplFileObject::__construct(import_mmt_20140701.csv): failed to open stream: No such file or directory in /in/MJ6GM:2 Stack trace: #0 /in/MJ6GM(2): SplFileObject->__construct('import_mmt_2014...', 'r') #1 {main} thrown in /in/MJ6GM on line 2
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(import_mmt_20140701.csv): failed to open stream: No such file or directory' in /in/MJ6GM:2 Stack trace: #0 /in/MJ6GM(2): SplFileObject->__construct() #1 {main}
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(import_mmt_20140701.csv): failed to open stream: No such file or directory' in /in/MJ6GM:2 Stack trace: #0 /in/MJ6GM(2): SplFileObject->__construct('import_mmt_2014...', 'r') #1 {main} thrown in /in/MJ6GM on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/MJ6GM on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/MJ6GM on line 2 Parse error: syntax error, unexpected '[' in /in/MJ6GM 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
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/MJ6GM on line 2 Parse error: parse error, unexpected '[' in /in/MJ6GM on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/MJ6GM on line 2 Parse error: parse error in /in/MJ6GM on line 3
Process exited with code 255.