Skip to content

Instantly share code, notes, and snippets.

@r37r0m0d3l
Created September 12, 2012 12:14
Show Gist options
  • Save r37r0m0d3l/3706231 to your computer and use it in GitHub Desktop.
Save r37r0m0d3l/3706231 to your computer and use it in GitHub Desktop.
Is string match pattern
<?php
function str_is_match($pattern, $string)
{
$array = null;
$res = preg_match_all('('.$pattern.')', $string, $array);
return !(($res === false) or ($res == 0) or ($res > 1) or ($array[0][0] != $string));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment