<?php
// Simple wildcard matching function
function wildcard_match($pattern, $haystack)
{
$tokens = explode("*", $pattern);
foreach($tokens as $token)
{
if( strlen($token) == 0 ) continue;
$t = strpos($haystack, $token);
if( $t !== false && $t >= $x )
$x = $t;
else
return false;
}
return true;
}
$s = "Hello Joe and Jane";
$p = "Hello * and *";
var_dump( wildcard_match($p, $s) );