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

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -