Created
June 17, 2015 09:52
-
-
Save stoimen/cdc433af43d3f396fd2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// unordered list | |
$arr = array(1, 2, 3, 3.14, 5, 4, 6, 9, 8); | |
// searched value | |
$x = 3.14; | |
$index = null; | |
for ($i = 0; $i < count($arr); $i++) { | |
if ($arr[$i] == $x) { | |
$index = $i; | |
} | |
} | |
if (isset($index)) { | |
return true; | |
} else { | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment