array_pop()
functionYou can use the PHP array_pop()
function to remove an element or value from the end of an array. The array_pop()
function also returns the last value of array. However, if the array is empty (or the variable is not an array), the returned value will be NULL
.
Let's check out an example to understand how this function basically works:
<?php
$sports = array("Baseball", "Cricket", "Football", "Shooting");
// Deleting last array item
$removed = array_pop($sports);
print_r($sports);
echo "<br>";
var_dump($removed);
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Send Email with Laravel and SendGrid
Recently while working on Laravel mail f...PHP Find Key of Minimum value in Given Array
On working with huge data, sometimes you...How to check request is ajax or not in Laravel
In this tutorials we will share with you...React Responsive Animated Navbar Example
In this article, I will share with you h...Laravel 5.5 - VueJS 2.0 CRUD Operations
Today, we are share with you VueJS 2.0 C...