In my PHP-script I have a multidimensional and associative array I want to "transform" into a javascript array. The array looks like this in PHP:
<?php
$myArray = array(
array( "value" => 1, "label" => "First" ),
array( "value" => 2, "label" => "Second" )
)
?>
And now I want to create that array into an equivalent array in javascript, through a foreach-loop. Something like this:
<script>
var myArrayInJS = new Array();
<? foreach( $myArray as $innerArray ): ?>
// What do I write here?
<? endforeach; ?>
</script>