Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

javascript php loop

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

<script type="text/javascript">

var fromPHP=<? echo $s_to_json ?>;

for (i=0; i<fromPHP.length; i++) {

yourValue=fromPHP[i];

}

</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #php #loop
ADD COMMENT
Topic
Name
7+1 =