Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macro Statements

Expression Editor

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

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: March 19, 2023
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Array Functions > Array_PushBack

Array_PushBack

Inserts the given value to the end of the array. Returns the number of elements in the array after the insertion. To use an array as a stack, use this function along with Array_PopBack. To use an array as a queue, use this function along with Array_PopFront.

Syntax

Numeric Array_PushBack(
	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) $sizeAfterFirstPushBack = Array_PushBack($array, 3) $sizeAfterSecondPushBack = Array_PushBack($array, 7) // $array is now (6, 4, 8, 3, 7) // $sizeAfterFirstPushBack is 4 // $sizeAfterSecondPushBack is 5 // You can create an array with Array_PushBack Array_PushBack($array2, 5) // $array2 is now (5) Array_PushBack($array2, 7) // $array2 is now (5, 7) // If the array doesn't have numeric keys, new keys will start from 0 $array3["size"] = "large" $array3["color"] = "red" Array_PushBack($array3, "t-shirt") Array_PushBack($array3, 10) // $array3 is now: // "size" => "large" // "color" => "red" // 0 => "t-shirt" // 1 => 10 // If the array had some numeric keys, new keys will follow the largest one $array4[7] = "a" $array4[-2] = "b" $array4["price"] = 100 Array_PushBack($array4, "first") Array_PushBack($array4, "second") // $array4 is now: // 7 => "a" // -2 => "b" // "price" => 100 // 8 => "first" // 9 => "second"

Reference

Statements

For

ForEach

If

Else If

Else

Switch

Case

Default

While

Expression

Comment

Break

Continue

Return

Hierarchy Objects

NotebookRoot

Notebook

SectionGroup

Section

Page

Page Objects

Title

Outline

Table

Column

Row

Cell

Paragraph

Text

Image

EmbeddedFile

Tag

Other Objects

DialogBox

MacroMenu

Window

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

String Functions

Window Functions