Formating the json data in php -
i have json data in following format
["0","0","0","0","0","0","0","2","5","4","3","0"]
i want convert above data in following format using php
[0,0,0,0,0,0,0,2,5,4,3,0]
how can using php
thanks
you can use array_map typecast items in array integer callback intval.
for integers in array:
$array = array_map('intval', json_decode('["0","0","0","0","0","0","0","2","5","4","3","0"]'));
retrieve json array:
echo json_encode($array);
Comments
Post a Comment