\"Floured Or Breaded, Fried\"" />
开发者

In PHP, Removing first element in CSV String

开发者 https://www.devze.com 2023-01-05 23:28 出处:网络
I\'m simply looking to take the first csv out of a string, using PHP. Here are a few examples: \"Sea Bass, Floured Or Breaded, Fried\" => \"Floured Or Breaded, Fried\"

I'm simply looking to take the first csv out of a string, using PHP. Here are a few examples:

  • "Sea Bass, Floured Or Breaded, Fried" => "Floured Or Breaded, Fried"
  • "Tuna, Fresh, Baked Or Broiled" => "Fresh, Baked Or Broiled"
  • "Croaker, Bread开发者_如何学JAVAed Or Battered, Baked" => "Breaded Or Battered, Baked"

And so on...

Thank you.


You can try this:

$csvArray = explode(",", $csv);
array_shift($csvArray);
$newCsv = implode(",", $csvArray);


I suggest using str_getcsv or something similar that parses csv, this will take into account any quotation marks and commas in the CSV string. after that you can just array_shift

0

精彩评论

暂无评论...
验证码 换一张
取 消