1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <?php
function DeleteIn($ArtId){
foreach($_SESSION["panier"] as $id => $Panier)
{
if($Panier["Id_Article"] == $ArtId)
{
unset($_SESSION["panier"][$id]);
break;
}
}
}
$_SESSION['panier'][0] = array('Id_Article' => 1, 'Titre' => 'Cartouche encre noir', 'Quantite' => 1, 'Prix' => 8.49);
$_SESSION['panier'][1] = array('Id_Article' => 3, 'Titre' => 'CD RW', 'Quantite' => 1, 'Prix' => 2.99);
$_SESSION['panier'][2] = array('Id_Article' => 16, 'Titre' => 'Lecteur DVD', 'Quantite' => 1, 'Prix' => 57.99);
print_r($_SESSION);
DeleteIn(3);
print_r($_SESSION); |
Partager