Last active
April 12, 2016 17:03
-
-
Save juniorb2ss/c77fa8b24d704294431f8626ca2d626c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = 'http://meusite.com.br/wp-admin.php'; | |
$BlackListURL = ["wp-admin.php", "admin", "administrator", "wp-login.php"]; | |
/** Procure por uma parte da string no texto **/ | |
function hasString($search, $text, &$found) { | |
if (!is_array($search)) { | |
$search = [ | |
$search, | |
]; | |
} | |
foreach ($search as $keys => $value) { | |
$position = strpos($text, $value); | |
if ($position !== false) { | |
$found = $value; | |
return true; | |
} | |
} | |
return false; | |
} | |
# | |
$hasString = hasString($BlackListURL, $string, $found); | |
var_dump($hasString); // true | |
var_dump($found); // wp-admin.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment