pass array to javascript function from php code example Example: php array to js var arrNums = json_encode(<?php echo $arrNums; ?>);