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]
Get Current time and date in React
In this tutorial, we will discuss how to...Laravel Passport - Create REST API with authentication
Today, in this tutorial we are share wit...PHP Check if string is valid url Code Example
When I was working with one Payment gate...Set Up Angular Project From Scratch
Angular is open-source web application f...How to Create virtual environment in Python3
Python virtual environment is tool that...