need to loop through a PHP array in JavaScript

Posted by user296516 on Stack Overflow See other posts from Stack Overflow or by user296516
Published on 2010-04-18T18:42:55Z Indexed on 2010/04/18 18:53 UTC
Read the original article Hit count: 135

Filed under:
|

Hi guys, For example I have a PHP array, such as this one

<?php $s= array('a','b','c','d','e','f') ; ?>

And I need to loop through it in JavaScript, any ideas how do I do that?

for ( i=0 ; i < <?php echo sizeof($s) ?> ; i++) {
document.write('<?php echo $s [somehow need to get the 'i' value into here] ?>');
}

Any suggestions? Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript