PHP Programing language

array_shift() Function in PHP
Previous Home Next

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

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: