In PHP I can do like:  $arrayname[] = 'value';   Then the value will be put in the last numerical key eg. 4 if the 3 keys already exists.  In JavaScript I can’t do the same with:  arrayname[] = 'value';   How do you do it in JavaScript?
26027
How do I append an object (such as a string or number) to an array in JavaScript?
7172
What would be the best way to look in a string[] to see if it contains a element. This was my first shot at it. But perhaps there is something that I am overlooking. The array size will be no larger than 200 elements.  bool isStringInArray(string[] strArray, string key) {     for (int i = 0; i &lt;= strArray.Length - 1; i++)         if (strArray[i] == key)             return true;     return false; }
93369
I'm trying to figure out how to make a function that can take an array as a parameter and sort it. I think it is done with positional variables, but I'm not sure.
2878
I want to use a PHP variable in JavaScript. How is it possible?
717
What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) {     for (var i = 0; i &lt; a.length; i++) {         if (a[i] === obj) {             return true;         }     }     return false; }  Is there a better and more concise way to accomplish this?
9942
Is there an easy way to delete an element from an array using PHP, such that foreach ($array) no longer includes that element?  I thought that setting it to null would do it, but apparently it does not work.
2961
I have a JavaScript object like the following:  var p = {     "p1": "value1",     "p2": "value2",     "p3": "value3" };   Now I want to loop through all p elements (p1, p2, p3...) And get their keys and values. How can I do that?  I can modify the JavaScript object if necessary. My ultimate goal is to loop through some key value pairs and if possible I want to avoid using eval.
10572
Given an array of n Objects, let's say it is an array of strings, and it has the following values:  foo[0] = "a"; foo[1] = "cc"; foo[2] = "a"; foo[3] = "dd";   What do I have to do to delete/remove all the strings/objects equal to "a" in the array?
6261
I am looking for a JavaScript array insert method, in the style of:  arr.insert(index, item)   Preferably in jQuery, but any JavaScript implementation will do at this point.
93651
I want to compare 2 arrays of objects in JavaScript code.  The objects have 8 total properties, but each object will not have a value for each, and the arrays are never going to be any larger than 8 items each, so maybe the brute force method of traversing each and then looking at the values of the 8 properties is the easiest way to do what I want to do, but before implementing, I wanted to see if anyone had a more elegant solution. Any thoughts?
110764
In the past and with most my current projects I tend to use a for loop like this:  var elements = document.getElementsByTagName('div'); for (var i=0; i&lt;elements.length; i++) {     doSomething(elements[i]); }   I've heard that using a "reverse while" loop is quicker but I have no real way to confirm this:  var elements = document.getElementsByTagName('div'),      length = elements.length;  while(length--) {     doSomething(elements[length]); }   What is considered as best practice when it comes to looping though elements in JavaScript, or any array for that matter?
93053
(assume php5) consider  &lt;?php      $foo = 'some words';      //case 1     print "these are $foo";      //case 2     print "these are {$foo}";      //case 3     print 'these are ' . $foo; ?&gt;   Is there much of a difference between 1 and 2?  If not, what about between 1/2 and 3?
29178
I have the following code:  if ($_POST['submit'] == "Next") {     foreach($_POST['info'] as $key =&gt; $value) {         echo $value;     } }   How do I get the foreach function to start from the 2nd key in the array?
92311
What is an elegant way to sort objects in PHP? I would love to accomplish something similar to this.  $sortedObjectArary = sort($unsortedObjectArray, $Object-&gt;weight);   Basically specify the array I want to sort as well as the field I want to sort on. I looked into multidimensional array sorting and there might be something useful there, but I don't see anything elegant or obvious.
10523
I know how to do it normally, but I could swear that you could fill out out like a[0] = {0,0,0,0}; How do you do it that way? I did try Google, but I didn't get anything helpful.
94409
I have the following arrays in PHP (okay they are a bit bigger but the idea is what counts).  $array1 = array(1 =&gt; 'a', 2 =&gt; 'b'); $array2 = array(3 =&gt; 'c', 4 =&gt; 'd');   Essentially I want to combine the two arrays as if it were something like this  $array3 = array(1 =&gt; 'a', 2 =&gt; 'b', 3 =&gt; 'c', 4 =&gt; 'd');   Thanks
103558
Is there an inbuilt PHP function to replace multiple values inside a string with an array that dictates exactly what is replaced with what?  For example:  $searchreplace_array = Array('blah' =&gt; 'bleh', 'blarh' =&gt; 'blerh'); $string = 'blah blarh bleh bleh blarh';   And the resulting would be: 'bleh blerh bleh bleh blerh'.