$foo = array(); $foo[1] = "a"; $foo[2] = "b"; $foo[0] = "c"; ---- check_if_first_index($foo[2]); ^^^ Should return false, as the first index is $foo[1]