Skip to main content
added 37 characters in body
Source Link
Dinesh
  • 3.1k
  • 1
  • 21
  • 19

Your foreach wont make any changes since a copy of array is used.. you will need to use pass by reference in order for this to work. one of the way is mentioned below

  while(list($key,$value) = each($array)){
   if(your reason to unset)
       unset($array[$key]);
}

this will remove the element from the array.

Your foreach wont make any changes since a copy of array is used.. you will need to use pass by reference in order for this to work. one of the way is mentioned below

  while(list($key,$value) = each($array)){
   if(your reason to unset)
       unset($array[$key]);
}

this will remove the element from the array.

Your foreach wont make any changes since a copy of array is used.. you will need to use pass by reference in order for this to work. one of the way is mentioned below

  while(list($key,$value) = each($array)){
   if(your reason to unset)
       unset($array[$key]);
}

this will remove the element from the array.

added 37 characters in body
Source Link
Dinesh
  • 3.1k
  • 1
  • 21
  • 19

Your foreach wont make any changes since a copy of array is used.. you will need to use pass by reference in order for this to work. one of the way is mentioned below

  while(list($key,$value) = each($array)){
   if(your reason to unset)
       unset($array[$key]);
}

this will remove the element from the array.

Your foreach wont make any changes since a copy of array is used.. you will need to use pass by reference in order for this to work. one of the way is mentioned below

  while(list($key,$value) = each($array)){
   unset($array[$key]);
}

this will remove the element from the array.

Your foreach wont make any changes since a copy of array is used.. you will need to use pass by reference in order for this to work. one of the way is mentioned below

  while(list($key,$value) = each($array)){
   if(your reason to unset)
       unset($array[$key]);
}

this will remove the element from the array.

Source Link
Dinesh
  • 3.1k
  • 1
  • 21
  • 19

Your foreach wont make any changes since a copy of array is used.. you will need to use pass by reference in order for this to work. one of the way is mentioned below

  while(list($key,$value) = each($array)){
   unset($array[$key]);
}

this will remove the element from the array.