CI irrelevant, but help please - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: CI irrelevant, but help please (/showthread.php?tid=5073) |
CI irrelevant, but help please - El Forum - 01-04-2008 [eluser]cinewbie81[/eluser] Hi, this is CI irrelevant, but i need ur help. Im checking if $value exists in $Temp arary or not. The code as following: Code: $value = '123'; It generate me the following error : Severity: Notice Message: Undefined index: 123 Any idea ? CI irrelevant, but help please - El Forum - 01-04-2008 [eluser]xwero[/eluser] that's some weird code If you just created the array nothing is in it so you don't need to check if the $value exists. I'm not sure if you want to check if the value is present in the array as a key or as a value. If you want to check if the key exists Code: if(isset($Temp[$value])) Code: if(is_numeric(array_search($value,$Temp))) CI irrelevant, but help please - El Forum - 01-04-2008 [eluser]gunter[/eluser] why donĀ“t you use the native php functions for this?? in_array() - value exists CI irrelevant, but help please - El Forum - 01-04-2008 [eluser]xwero[/eluser] gunters solution for searching the value is better (less functions) and for the key you could use Code: array_key_exists($value,$Temp); CI irrelevant, but help please - El Forum - 01-04-2008 [eluser]cinewbie81[/eluser] cheers guys ... got it solved ... million thanks |