-2
mysql returns the following string: ["Element1", "Element2", "Element3", "Element4", "Element5", "Element6"]
I need to transform each of the words between "" into an element of an array. I tried from the preg_split and preg_match_all functions but could not get the correct regular expression.
If it’s a JSON, why don’t you try
json_decode
?– Woss
@Andersoncarloswoss because JSON_EXTRACT is a function executed in mysql query that brings only the desired JSON information without having to go through it in PHP
– jaeger
But he converts his string in the array which you need, if I understand correctly what you want to do.
– Woss
@Andersoncarloswoss transforms the result into a string. I need to transform what is between " " into components of an array.
– jaeger
Look at my answer. It seems you don’t quite understand how
json_decode
works; but if it is not what I answered, I ask you to edit the question and clarify better what you need to do, because the way you are making it seem that it is enough to use this function, because it generates the array with all the strings.– Woss