Jump to content

remove an element from an array


livewirerules

Recommended Posts

Im trying to remove an element from an array, but the problem is that although that it removes the value and adds it again into the array..

 

if (isset($_POST['remove'])) {

$ele=$_GET['id']; //id passed from the form
$key1=array_search($ele,$_SESSION['id']);
echo $key1;
unset($_SESSION['id'][$key1]);
}

 

can some one tell me what i am doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/191656-remove-an-element-from-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.