Articles tagged with: array
PHP »
Here is a quick tip on parsing and unparsing string and array in PHP.
You can parses the string into variables by using the parse_str PHP function.
Using parse_str function
jQuery »
It’s very easy to print array and object with jQuery. You can do it with jQuery.each() function. The jQuery.each() function can be used to iterate over any collection, whether it is a map (JavaScript object) or an array.
Here is the javascript code to print array or object:
jQuery(document).ready(function(){
var arr = [ "earth", "mars", "jupiter", "saturn", "venus" ];
var obj = { one:"earth", two:"mars", three:"jupiter", four:"saturn", five:"venus" };
jQuery.each(arr, function(i, val) {
$("#arrData").append(i + " : " + val + "<br/>");
});
jQuery.each(obj, function(i, val) {
$("#objData").append(i + " => " + val + …
Javascript »
It’s a real headache when you have to work on objects and arrays in Javascript. It would be lot easier to detect elements of the Javascript objects/arrays if we have print_r function in Javascript as we have in PHP.
I googled the web and have found a very efficient print_r Javascript function. This has helped me a lot in my projects. Here is the code:-
Javascript, PHP »
I had to work on multi-dimensional array with javascript and php. I had a multi-dimensional array in php. I had to load it into javascript array and then populate the html selection list.
The challenge for me was to create multi-dimensional array in javascript and populate selection list with for loop in javascript.

