PHP

PHP Menu

PHP

array_pop() Function - Definition, Syntax, Parameters, Examples

Definition

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

Syntax

array_pop(array)

Parameters

Parameter Description
array Required. Specifies the array to get the last value from.

Example

<?php
// Example 1 $cities = array("New York", "Salt Lake", "Tokyo"); array_pop($cities); print_r($cities); echo "<br>";
// Example 2 $ages = array("Mark" => 22, "Jeff" => 32, "Mike" => 28); array_pop($ages); print_r($ages); echo "<br>";

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods