views:

39

answers:

3

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 hold $PostedDate.

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

+1  A: 

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.

Brad
+1  A: 

put the strings onto a php array like so:

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

Drew LeSueur