I'm having some troubles trying to iterate over a PHP array inside a Javascript array... I've searched over the forum and, though I found some posts about copying PHP values to Javascript values, I'm unable to find exactly what I'm trying to achieve...
I have a PHP array of arrays called "phpArray", and I want each value of this array to be copied into a Javascript array of arrays (called "javaArray"). I have a Javascript loop that populates the Javascript array when the "phpArray" comes empty, and I'm simply trying to use a PHP index to iterate over the "phpArray". However, it acts as if the PHP index is never increased, and the only array value that I can get is the first one of the "phpArray"... Here is the piece of code corresponding to this:
for (var i = 0; i < javaArray.length; i++) {
javaArray[i] = new Array(<?php echo $numCols; ?>);
for (var j = 0; j < javaArray[i].length; j++) {
javaArray[i][j] = "0";
<?php
if(sizeof($javaArray) > 0)
{
?>
javaArray[i][j] = "<?php echo $phpArray[$i][$j]; ?>";
<?php
}
?>
}
}
Any idea on how can I do this?
Thanks in advance for your time and effort! :)