Skip to content

Instantly share code, notes, and snippets.

@atomize
Created April 4, 2013 03:24
Show Gist options
  • Save atomize/5307448 to your computer and use it in GitHub Desktop.
Save atomize/5307448 to your computer and use it in GitHub Desktop.
php in js in html
<html>
<head>
<script type="text/javascript">
var myData = Array(); //create the blank array variable
//now add values to the array from PHP
<?php
echo " myData[0] = '" . $variable1 . "';";
echo " myData[1] = '" . $variable2 . "';";
echo " myData[2] = '" . $variable3 . "';";
?>
</script>
</head>
<body>
..document body...
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment