Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

array_pop()

Example

Remove the last element from an array:

<?php
$a=array(“red”,“green”,“blue”);
array_pop($a);
print_r($a);
?>

Definition and Usage

The array_pop() function removes the last element from an array.

Syntax

array_pop(array)

Parameter Values

Parameter

Description

array

Required. Defines an array.

Technical Details

Return Value:

Returns the last value of the array. If the array is empty or not an array, NULL will be returned.

PHP Version:

4+