Web | This Site

Learning PHP
Advanced PHP
PHP Function Reference
PHP Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# PHP Function array_pop()

## Syntax

array_pop ( $array );

## Definition and Usage

This function pops and returns the last value of the array, shortening the array by one element. If array is empty (or is not an array), NULL will be returned.

## Paramters

Parameter | Description
--- | ---
array | Required. Specifies an array.

## Return Values

It returns the last value of the array, shortening the array by one element.

## Example

Try out following example:

    <?php
    $array=array("a"=>"banana","b"=>"apple","c"=>"orange");

    print_r(array_pop($array));
    print_r("<br />");
    print_r(array_pop($array));
    ?>

This will produce following result:

    orange
    apple

Advertisement

Online Image Processing

Indian Baby Names