File "pass_array.php"

Full Path: /home/analogde/www/Prog/MMM/Fusion/Picker02/pass_array.php
File size: 585 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
     
// Create an array 
$sampleArray = array( "Geeks",  "for", "proto"); 
?> 
   
<script> 
  
// Access the array elements 
var passedArray =  
    <?php echo json_encode($sampleArray); ?>; 
       
	  console.log(passedArray); 
	   
// Display the array elements 
for(var i = 0; i < passedArray.length; i++){ 
    document.write("<p>" + passedArray[i] + "</p>"); 
} 
</script> 

<script>
   document.write("<div>Affichage de 5 nombres aléatoires</div>");
   for (var i=0; i<5; i++) {
       document.write("<p>"+Math.random()+"</p>");
   }
</script>