3v4l.org

run code in 200+ PHP versions simultaneously
<?php $s2=<<<EOD Year,Make,Model,Description,Price 1997,Ford,E350,"ac, abs, moon",3000.00 1999,Chevy,"Venture ""Extended Edition""","",4900.00 1999,Chevy,"Venture ""Extended Edition, Very Large""","",5000.00 1996,Jeep,Grand Cherokee,"MUST SELL! ""TODAY"" air, moon roof, loaded",4799.00 EOD; $lines = explode("\n", $s2); $lines[4] .= "\n$lines[5]"; unset($lines[5]); foreach ($lines as $line) { print_r(str_getcsv($line)); }
based on Q5IKu
Output for 7.1.25 - 7.4.6
Array ( [0] => Year [1] => Make [2] => Model [3] => Description [4] => Price ) Array ( [0] => 1997 [1] => Ford [2] => E350 [3] => ac, abs, moon [4] => 3000.00 ) Array ( [0] => 1999 [1] => Chevy [2] => Venture "Extended Edition" [3] => [4] => 4900.00 ) Array ( [0] => 1999 [1] => Chevy [2] => Venture "Extended Edition, Very Large" [3] => [4] => 5000.00 ) Array ( [0] => 1996 [1] => Jeep [2] => Grand Cherokee [3] => MUST SELL! "TODAY" air, moon roof, loaded [4] => 4799.00 )