开发者

Retrieve values from json encoded string

I am storing a concatenated string like this:

echo json_encode($PostedDate.$Places.$Company.$Designation.$ProjectDetails.$DesiredCandidate.$HRName.$HRContact.$Email);

I can split this string using JavaScript and store values in an array. But what I want to know is that suppose any of the values above is null, will it affect the array position?

Because, I want to keep the array location fixed. For example:

myArray[0] must hol开发者_运维问答d $PostedDate.

If $PostedDate is null, then also, myArray[0] must be equal to NULL. $Places must not take the position of myArray[0].


put the strings onto a php array like so:

echo json_encode(array($PostedDate,$Places,$Company));


You may find this interesting on how to preserve array location


Put it into an array in php and then json_encode the array. Then you dont need to do your crazy split on the javascript side and you dont need to worry about preserving a position in a string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜