Skip to content
Chung Leong edited this page Jan 10, 2022 · 3 revisions

array_reverse - Return an array with elements in reverse order

array array_reverse ( array $array )

array_reverse() takes an input array and returns a new array with the order of the elements reversed.

Parameters:

array - The input array.

Return Value:

An array with the same contents as array in reversed order.

Examples:

/**
 * flip() - flip an image up-side-down
 *
 * @engine qb
 * @param image		$image
 */
function flip(&$image) {
	$image = array_reverse($image);
}
/**
 * mirror() - flip an image horizontally
 *
 * @engine qb
 * @param image		$image
 * @local uint32	$i
 */
function mirror(&$image) {
	for($i = 0; $i < count($image); $i++) {
		$image[$i] = array_reverse($image[$i]);
	}
}

Version

1.0 and above.

Clone this wiki locally