Skip to content
17 changes: 17 additions & 0 deletions src/string_search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
function string_search($needle, $haystack){

if ($needle==false) {
return false;
} else {

$position = strpos($haystack, $needle);

if ($position===0 | $position >0){
return "Found '$needle' at index $position";
} else {
return false;
}
}
}
?>