Skip to content
Advertisement

Convert an array string into an array

How do I convert '["1","2-1","3-1-1"]' into ["1","2-1","3-1-1"]?

So, a string into an array.

I’ve tried casting '["1","2-1","3-1-1"]' to an array, but that does not work.

Advertisement

Answer

Use json_decode:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement