PHP Programing language

adplus-dvertising
array_shift() Function in PHP
Previous Home Next
adplus-dvertising

array_shift()

The array_shift() function removes the first element from an array, and returns the value of the removed element.

Syntax:
array_shift(array)

In above syntax, "array" specifies an array

Example:

<?php
$a=array("a"=>"Apple","b"=>"Banana","c"=>"Orange");
echo array_shift($a)."<br>";
print_r ($a);
?>

Output:

Apple
Array ( [b] => Banana [c] => Orange )

Previous Home Next