I want to convert a string like this code below to array, How can I do this plz?
$icon = '{``font``:``feather``,``icon``:``feather-facebook``}';
Is there any way by using json_decode or something like this?
Thanks.
1 Answer 1
- The input string is not proper json format
- When you correct json syntax then you can just json_decode it
$icon = '{"font":"feather","icon":"feather-facebook"}';
$array = json_decode($icon);
var_dump($array);
answered Sep 10, 2020 at 4:14
Shubham Srivastava
1,8951 gold badge11 silver badges17 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-php
str_replace()the double backtics with a quote.