Core Function Push

From Sputnik Wiki
Jump to: navigation, search
Push( <array>, <expressions> )

Contents

Description

Add items to the end of an array

Parameters

array

The array to use.

expressions

One or more values to add to the array.

Return Value

Success - Returns how many elements were done.

Failure - Returns 0.

Remarks

None

Example

$array = array ( "One", "Two" );
 
push($array, "Three");
push($array, "Four", "Five");
 
$i = 0;
Foreach ( $array as $i )
{
	println("Element ($i) is: " . $i);
	$i++;
}

Alternative method using the .= operator

$array = array ( "One", "Two" );
 
$array .= array("Three");
$array .= array("Four", "Five");
 
$i = 0;
Foreach ( $array as $i )
{
	println("Element ($i) is: " . $i);
	$i++;
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox