fork download
  1. <?php
  2.  
  3. $clubes = '["{\"clube\":[\"Flamengo\"]}"]';
  4. $clubes = json_decode($clubes, true);
  5. array_push($clubes[0]->clube, 'Santos');
  6. print_r($clubes);
Success #stdin #stdout #stderr 0.02s 82880KB
stdin
Standard input is empty
stdout
Array
(
    [0] => {"clube":["Flamengo"]}
)
stderr
PHP Warning:  Attempt to modify property of non-object in /home/IuqUw6/prog.php on line 5
PHP Warning:  array_push() expects parameter 1 to be array, null given in /home/IuqUw6/prog.php on line 5