you can serialize an array in php using json_encode and use it inside JS
http://php.net/manual/en/function.json-encode.php
<?php $series = array("name"=>"N51", "data"=>array(1024, array("y"=>2048, "events"=>array("mouseOver"=>'function(){$reporting.html(\'description of value\');}') ), 4096) ); json_encode($series); ?>
The above code outputs:
{"name": "N51", "data": [1024, {"y": 2048, "events": {"mouseOver": "function () {$ reporting.html ('description of value');} "}}, 4096]}
source share