Arrays with PHP, Jquery & JSON -
i'm looking saving array text file later access, wonder way better save array? opinion question! want know better way save why there null in there on first part?
{ "questionbanknames": "question bank name", "question": [null, { "question": "this question 1?", "type": "manual", "a": "", "b": "", "c": "", "d": "" }, { "question": "this question 2?", "type": "multi", "a": "yes", "b": "no", "c": "maybe", "d": "all of above" }] }
or
"questionbanknames": "question bank name", "question[1][question]": "this question 1?", "question[1][type]": "manual", "question[1][a]": "", "question[1][b]": "", "question[1][c]": "", "question[1][d]": "", "question[2][question]": "this question 2?", "question[2][type]": "multi", "question[2][a]": "yes", "question[2][b]": "no", "question[2][c]": "maybe", "question[2][d]": "all of above"
i prefer storing json format without serializing. makes easier multiple clients consume in future. creating php object json string breeze.
so serialize if not json, save as-is if json.
Comments
Post a Comment