fork download
  1. <?php
  2.  
  3. $history = array();
  4.  
  5. $history[] = json_decode('{"assigned_to":"AAA","end_date":"2018-09-12","comments":"happy"}');
  6. $history[] = json_decode('{"assigned_to":"AAA","end_date":"2018-09-12","comments":"jolly"}');
  7. $history[] = json_decode('{"assigned_to":"AAA","end_date":"2018-09-12","comments":"xvbcvbdfghdfg"}');
  8.  
  9. $end_date = [
  10. 'assigned_to' => "BBB",
  11. 'end_date' => "2018-09-13",
  12. 'comments' => "test"
  13. ];
  14. $history[] = $end_date;
  15.  
  16. $json = json_encode($history);
  17.  
  18. echo $json;
Success #stdin #stdout 0.01s 82560KB
stdin
Standard input is empty
stdout
[{"assigned_to":"AAA","end_date":"2018-09-12","comments":"happy"},{"assigned_to":"AAA","end_date":"2018-09-12","comments":"jolly"},{"assigned_to":"AAA","end_date":"2018-09-12","comments":"xvbcvbdfghdfg"},{"assigned_to":"BBB","end_date":"2018-09-13","comments":"test"}]