coldfission Posted September 9, 2008 Share Posted September 9, 2008 if ($key = array_search($sku,$inventory_sku)) { $inventory_q[$key] = $inventory_q[$key] + $quantity; } else { $inventory_q[$inv_count] = $quantity; $inventory_sku[$inv_count] = $sku; $inv_count++; } What if the $key = 0? That tells the IF statement that it is false and, in my case, will insert a new record when i don't want it to. How do i solve this problem? thanks Link to comment https://forums.phpfreaks.com/topic/123503-array_search-returns-zero-and-thinks-false/ Share on other sites More sharing options...
sasa Posted September 9, 2008 Share Posted September 9, 2008 if (($key = array_search($sku,$inventory_sku))!==false) Link to comment https://forums.phpfreaks.com/topic/123503-array_search-returns-zero-and-thinks-false/#findComment-637830 Share on other sites More sharing options...
coldfission Posted September 10, 2008 Author Share Posted September 10, 2008 thanks that did it Link to comment https://forums.phpfreaks.com/topic/123503-array_search-returns-zero-and-thinks-false/#findComment-638366 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.