Skip to content

Commit 2cc2736

Browse files
refactoring index_of
1 parent 115746e commit 2cc2736

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/IndexOf.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ function index_of(iterable $haystack, $element, bool $strict = true)
1818
}
1919

2020
foreach ($haystack as $index => $value) {
21-
if (($strict === true && $element === $value)
22-
|| ($strict === false && $element == $value)
23-
) {
21+
if (($strict && $element === $value) || (!$strict && $element == $value)) {
2422
return $index;
2523
}
2624
}

0 commit comments

Comments
 (0)