3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $comp = '{[{"date":"2014-10-04","day:"mon"},{"date":"2014-10-03","day":"tue"}]}'; echo $comp; $arr1 = array('date' => '2015-10-04' , 'day' => 'wed'); print_R(json_decode($comp,true)); echo json_encode(array_push(json_decode($comp,true),$arr1));
based on 1s5L6
Output for 7.0.0 - 7.2.0
{[{"date":"2014-10-04","day:"mon"},{"date":"2014-10-03","day":"tue"}]} Notice: Only variables should be passed by reference in /in/JtKnK on line 7 Warning: array_push() expects parameter 1 to be array, null given in /in/JtKnK on line 7 null
Output for 5.5.0 - 5.6.28
{[{"date":"2014-10-04","day:"mon"},{"date":"2014-10-03","day":"tue"}]} Strict Standards: Only variables should be passed by reference in /in/JtKnK on line 7 Warning: array_push() expects parameter 1 to be array, null given in /in/JtKnK on line 7 null