I am writing code for add and remove array in php. The arrays are pushing succesfully according to my requirement. Now I want to remove the array element. But Here is the condition. I have duplicate values in this array. So I just want to remove only one element of duplicate values not all
Here is the code
<?php
session_start();
$id = $_POST['value'];
$_SESSION['id'] = $id ;
if(!isset($_SESSION['cart']))
{
$_SESSION['cart'] = array();
}
array_push($_SESSION['cart'], $id);
echo true;
?>
Here is the array I am getting
Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 0 [4] => 1 [5] => 1 [6] => 6 [7] => 0 [8] => 0 [9] => 2 [10] => 0 [11] => 0 [12] => 5 [13] => 1 [14] => 1 )
For example. I have multiple elements of 0 in this array. So I want to remove only one element not all.
Thanks