1

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
  • str_replace() the double backtics with a quote. Commented Sep 10, 2020 at 5:45

1 Answer 1

1
  1. The input string is not proper json format
  2. 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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.