CodeLab
Show Output
 
20
 
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
    <title>Example of Removing the Last Value from PHP Array</title>
5
</head>
6
<body>
7
​
8
<?php
9
$sports = array("Baseball", "Cricket", "Football", "Shooting");
10
 
11
// Deleting last array item
12
$removed = array_pop($sports);
13
print_r($sports);
14
echo "<hr>";
15
​
16
echo 'The value removed from the $sports array is - ' . $removed;
17
?>
18
​
19
</body>
20
</html>
 
Switch to SQL Mode Switch to HTML Mode

Share this example with Facebook, Twitter, Gmail. Please give us a Like, if you find it helpful.