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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -