1

I want to create a javascript array from databse like this:

var m = [
[one]
[two]
[three]
]

it is important that typeof m be object.

1 Answer 1

1

Use Json_encode

$phparray; // This is your php array 

$jsArray = <?php echo json_encode($phparray); ?>;

//do stuff with $jsArray now 
Sign up to request clarification or add additional context in comments.

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.