Created
September 10, 2020 11:40
-
-
Save aamsur-mkt/ddd8ecbc2fffcde43585d492c24a83f8 to your computer and use it in GitHub Desktop.
Search Static String Variable with Regex
This file contains 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 | |
// regex untuk mencari static variable | |
$re = "/(?s)'(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"/"; | |
$str = file_get_contents($_GET['file']); | |
preg_match_all($re, $str, $matches); | |
if(count($matches) <= 0){ | |
return; | |
} | |
foreach($matches[0] as $m){ | |
if($m != '""'){ | |
echo ($m); | |
echo "<br/><br/>"; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment