php array to javascript array April 09, 2011 <?php $arr = array("a","b","c"); ?> <script> var jsArray = ["<?php echo join("\", \"", $arr); ?>"]; alert(jsArray); alert(jsArray.length); </script> Read more
Parsing XML data and XML file with php April 08, 2011 <?php Step1: // Lets parse some xml data $data = '<?xml version="1.0"?> <organization><employees><employee><id>1</id><name>JohnChow</name><age>25</age></employee><employee><id>2</id><name>Simon</name><age>19</age></employee></employees></organization>'; $xml = simplexml_load_string($data); $response_arr = array(); foreach ($xml->xpath('//employee') as $ch) { $em... Read more