php array does not unset -
I am trying to unset my shopping cart array
  if (isset $ _ GET [Delete '])) {$ delete = $ _ GET [' delete ']; If ($ _GET ['delete'] == "all") {without set ($ _ session ['shopping cart']); } And {$ key = array_search ($ delete, $ _SESSION ['shoppingcart']); Not set ($ _ session ['shoppingkart'] [$ key]); }}    The second part removes only one value of the array. And it works, but the first part is not to delete the whole array. It only removes the first value.   
 
  I can see for some reason why this might happen .. either you think that It runs the first (unset set) part of the code, when it is actually running the second part. Or, using  print_r ($ _ session)  to see that you are still set, make sure to use it after using the code. ..   What you can try to see that the edges of the code are actually running, and in the  echo, the first statement was played.  and  echo 'second statement In some parts of the code ' is run. .   I say this, because  unset ($ _ session ['shopping cart']);  looks correct   
 
Comments
Post a Comment