As always, I would like to share whatever I meet in my programming work and hope it will save your time in your development.
Today, when I try to remove a value out of an array and figured out the best way to do. Here is my simple code:
[php]if(($key = array_search($device_id, $device_ids)) !== false) {unset($device_ids[$key]);
}[/php]
Above code, I want to remove a knew value of device_id out of a device_ids list. It ‘s quite simple and save us a lot of time to use foreach statement.
Hope it help.