php array to javascript array

Posted by Paidboom - 8 months ago

php array to javascript array

To convert you PHP array to javascript ,

var js_array = [<?php echo '"'.implode('","',  $membersIds ).'"' ?>];

or using JSON_ENCODE :

var js_array =<?php echo json_encode($membersIds );?>;