PHP array_shift()

📔 : PHP 🔗

array_shift() function , Array में से first element remove करता है। और removed element को ही return करता है।

PHP array_shift Syntax

array_shift( array $array );

  1. array $array | required : $array Array variable है , जिसमे से value remove करनी है।

  2. Return Value : removed element को ही return करता है।

    अगर pass किया गया Array empty है तो , null return होगा।

PHP array_shift Example

File : php_array_shift.php

Copy Fullscreen Close Fullscreen
  $stack = array("orange", "banana", "apple", "raspberry");
  echo "Removed element : ". array_shift($stack);
  echo "<br>";
Removed element : orange
Array ( [0] => banana [1] => apple [2] => raspberry )

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.

Get connected with me. :) LinkedIn Twitter Instagram Facebook