0

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].

3 Answers 3

1

put the strings onto a php array like so:

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

Sign up to request clarification or add additional context in comments.

Comments

1

You may find this interesting on how to preserve array location

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.