FANDOM


Push is a term used to refer to the addition of a node to a stack, and similar operations.

JavaScriptEdit

var length;
var arr1 = ["dog", "cat", "mouse"];
 
arr1.push(arr1, "gopher");
length = arr1.push("shrew");
 
alert(length); /* Returns: 5 */
alert(arr1.length); /* Returns: 5 */
alert(arr1); /* Returns: dog,cat,mouse,gopher,shrew */

PHP-JavaScriptEdit

PHP-JavaScript is an implementation of the PHP libraries in JavaScript. While the native libraries are recommended both for efficiency and for the sake of using libraries other JavaScript programmers know, the PHP-JavaScript alternative is documented below.

ImplementationEdit

function array_push(arr) {
	for (var i = 1; i < arguments.length; i++) {
		arr.push(arguments[i]);
	}
	return arr.length;
}

ExampleEdit

var arr1 = ["dog", "cat", "mouse"];
var total = array_push(arr1, "gopher", "shrew");
 
alert(total); /* Returns: 5 */
alert(arr1); /* Returns: dog,cat,mouse,gopher,shrew */

PHP Edit

array_push($arr, $var1, $var2);

or

$arr[] = $var1;
$arr[] = $var2;

PythonEdit

def array_push(arr, value)
	return arr.append(value)

Visual basicEdit

function array_push(arr,value)
	redim preserve arr(ubound(arr)+1)
	arr(ubound(arr)) = value
end function

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.