0

I am passing some data to a php page. I have a string data type which i need converted into an array. I have the below code:

$args = json_decode($form_update_args,true);

The value of $form_update_args is this $form_update_args = ["update","provider","jghjghjhhh",["folder_76248"]] So I need that string to be turned into an array so that it can be used liked so:

$field_to_update = $args[1];
$myvalue = $args[2];
$selection = $args[3];

However at the moment if you print $args after json_decode it is just empty, no value in there. printing $form_update_args brings back the text above.

What am I missing here?

edit: this is not the same as the posted example as his string looks completely different.

user3495256
  • 153
  • 2
  • 12
  • 1
    `$form_update_args` is actually not a string, but an array – Cid Apr 16 '19 at 12:40
  • 1
    Either @Cid is right, or the code works fine: https://3v4l.org/pG0VC – Nick Apr 16 '19 at 12:43
  • strange, when i used gettype() it returned string. the data is actually coming from a http request so is it broken maybe? here : https://gyazo.com/2766d1abfb346d48ff1cc12df323b226 – user3495256 Apr 16 '19 at 12:46
  • what is the result of `var_dump($form_update_args);` ? – Cid Apr 16 '19 at 13:14

0 Answers0