Last active
August 1, 2022 10:45
-
-
Save motebaya/b0299c1714081b444f36cfbe41237f9b to your computer and use it in GitHub Desktop.
for change /replace unreadable ascii variable to readable .
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 | |
/* | |
this to replace all php ascii variable to human readable | |
author: motebaya | |
gihtub.com/motebaya | |
*/ | |
function utf8($utf){ | |
return iconv('UTF-8', 'ISO-8859-1', $utf); | |
} | |
function clearvar($fn, $out){ | |
$file = utf8_encode(file_get_contents($fn)); | |
if (preg_match_all('/(?:\\$[\\x{0080}-\\x{FFFF}]+)(?=\\W)/u', $file, $code)) { | |
$vars = array_unique($code[0]); | |
$word = preg_split("/\r\n|\n|\r/", file_get_contents("word.txt")); | |
foreach ($vars as $i => $cd) { | |
$vm = "\${$word[$i]}"; | |
$file = str_replace($cd, $vm, $file); | |
} | |
if (file_put_contents($out, utf8($file))) { | |
die(" - saved in {$out}"); | |
} | |
} | |
} | |
if (count($argv) < 3){ | |
die("usage: php main.php <file/php> <out/php>"); | |
} else { | |
clearvar($argv[1], $argv[2]); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here for get word.txt file https://gist.github.com/motebaya/6d9a7e33591247a9723e862dab2b4d20