Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macros

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Using binary data

Sorting objects

Macro menus

Bulleted and numbered lists

Accessing the file system

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: April 20, 2025
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Array Functions > Array_PushFront

Array_PushFront

Inserts the given value to the beginning of the array. All numerical keys in the array will be modified to start counting from zero while string keys won't be affected. Returns the number of elements in the array after the insertion.

Syntax

Numeric Array_PushFront(
	byref Array array, 
	Mixed value)

Parameters

Array array
Array to insert the value to.
Mixed value
The value to insert.

Examples

$array = Array(6, 4, 8) $sizeAfterFirstPushFront = Array_PushFront($array, 3) $sizeAfterSecondPushFront = Array_PushFront($array, 7) // $array is now (7, 3, 6, 4, 8) // $sizeAfterFirstPushFront is 4 // $sizeAfterSecondPushFront is 5 // You can create an array with Array_PushFront Array_PushFront($array2, 5) // $array2 is now (5) Array_PushFront($array2, 7) // $array2 is now (7, 5) // Numeric keys will reset to start from 0 $array3[5] = 10 $array3[7] = 12 Array_PushFront($array3, 8) // $array3 is now: // 0 => 8 // 1 => 10 // 2 => 12 Array_PushFront($array3, 6) // $array3 is now: // 0 => 6 // 1 => 8 // 2 => 10 // 3 => 12 // String keys are not affected: $array4["size"] = "large" $array4[7] = "a" $array4[-2] = "b" $array4["color"] = "red" Array_PushFront($array4, "t-shirt") Array_PushFront($array4, 10) Array_PushFront($array4, 5) // $array4 is now: // 0 => 5 // 1 => 10 // 2 => "t-shirt" // "size" => "large" // 3 => "a" // 4 => "b" // "color" => "red"

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Clipboard Functions

Data Store Functions

Data Type Specific Functions

Date/Time Functions

Dialog Box Functions

File System Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions