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

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: September 02, 2024
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Array Functions > Array_RemoveByKey

Array_RemoveByKey

Removes the element with the given key from the array. Returns true if the key existed in the array and the element is removed, false if the key didn't exist in the array.

Syntax

Bool Array_RemoveByKey(
	byref Array array, 
	Mixed key)

Parameters

Array array
Array to remove the element from.
Mixed key
Key for the element to remove from the array.

Examples

// Array with numeric keys $array = Array(10, 12, 14, 16, 18) Array_RemoveByKey($array, 0) Array_RemoveByKey($array, 3) // $array is now: // 1 => 12 // 2 => 14 // 4 => 18 // Array with string keys: $array2["size"] = "large" $array2["color"] = "red" $array2["type"] = "t-shirt" Array_RemoveByKey($array2, "type") // $array2 is now: // "size" => "large" // "color" => "red"

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions