php - Confusion between false and 0 arrays -
basically have following code :
unset($items[array_search($i,$items)]);
when key not found array_search returns false equivalent returning 0, results in deleting element 0 of array if item value not found.
any workaround this?
$itemindex = array_search($i,$items); if ($itemindex !== false) { unset($items[$itemindex]); }
Comments
Post a Comment