json - PHP json_encode - Strange behaviour -
using json_encode
encode array of dates, 1 thing, another.
for example, if i'm trying encode like:
array(6) { [0]=> string(6) "jun-24" [1]=> string(6) "jun-25" [2]=> string(6) "jun-28" [3]=> string(11) "training-24" [4]=> string(6) "jun-29" [5]=> string(6) "jun-30" }
it output
["jun-24","jun-25","jun-28","training-24","jun-29","jun-30"]
however, when try encode like:
array(17) { [0]=> string(6) "jun-23" [1]=> string(6) "jun-24" [2]=> string(6) "jun-28" [3]=> string(11) "training-24" [4]=> string(6) "jun-29" [5]=> string(6) "jun-30" [6]=> string(6) "jul-06" [7]=> string(6) "jul-07" [9]=> string(6) "jul-09" [10]=> string(6) "jul-16" [11]=> string(6) "jul-17" [12]=> string(6) "jul-20" [13]=> string(6) "jul-23" [14]=> string(6) "jul-24" [15]=> string(6) "jul-30" [16]=> string(6) "aug-01" [17]=> string(6) "aug-05" }
it output
{"0":"jun-23","1":"jun-24","2":"jun-28","3":"training-24","4":"jun-29","5":"jun-30","6":"jul-06","7":"jul-07","9":"jul-09","10":"jul-16","11":"jul-17","12":"jul-20","13":"jul-23","14":"jul-24","15":"jul-30","16":"aug-01","17":"aug-05"}
(sorry, couldn't find smaller example fails)
point being, why this? options same, array structured same, what's issue?
your php array missing entry 8, mapping (object) , not list (array).
Comments
Post a Comment