Is it possible in PHP Regex to do partial matching so that if I have an array like:
$words = array("john", "steve", "amie", "kristy", "steven");
and I supply "jo" it would return "john" or if "eve" is supplied, it returns "steve"?
Is it possible in PHP Regex to do partial matching so that if I have an array like:
$words = array("john", "steve", "amie", "kristy", "steven");
and I supply "jo" it would return "john" or if "eve" is supplied, it returns "steve"?
$words = array("john","jogi", "steve", "amie", "kristy", "steven");
foreach ($words as $value) {
if (preg_match("|jo|", $value)) {
$arr[] = $value;
}
}
var_dump($arr);
This will return you array with john and jogi