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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.