970_90

Saturday, 7 March 2015

How to convert php array into javascript array

How to convert php array into javascript array

Converting PHP Array into java-script  array can be done by using json_ecode functions in php.
See, Following how to convert PHP Array into JavaScript Array.
 $phpArray = array(
      'web','web technology','web technology experts', 'web technology experts notes'
      );
      
      echo '<script>';
        echo 'var javaScriptArray ='.json_encode($phpArray);
      echo '</script>'; 



Output:
 
var javaScriptArray =["web","web technology","web technology experts","web technology experts notes"]





No comments:

Post a Comment