PHP array_pop()

📔 : PHP 🔗

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

PHP array_pop Syntax

array_pop ( array $array );

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

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

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


PHP array_pop Example

File : php_array_pop.php

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

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook