I want to parse a comma separated value string into an array. I want to try the str_getcsv() php function but I can’t find any good examples on how to use it.
For example I have an input where users submit tags for programming languages (php, js, jquery, etc), like the “tags” input in stackoverflow when you submit a question.
How would I turn an input with example value="php, js, jquery" into an array using str_getcsv?
Its true that the spec at https://www.php.net/manual/en/function.str-getcsv.php doesn’t include a standard example, but the user-submitted notes do a decent job of covering it. If this is a form input:
$datais now an array with the values. Try it and see if you have any other issues.