Created
July 30, 2015 23:13
-
-
Save moksamedia/d2a36ab16a32cc601043 to your computer and use it in GitHub Desktop.
Replaces escaped octal char codes in php with char
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 | |
/** | |
* Created by PhpStorm. | |
* User: cantgetnosleep | |
* Date: 7/30/15 | |
* Time: 4:50 PM | |
*/ | |
$chars = array(); | |
$i = 33; | |
for ($i=33; $i < 123; $i++ ) { | |
$oct = decoct($i); | |
if (strlen($oct) == 2) { | |
$oct = "0".$oct; | |
} | |
$char = chr($i); | |
echo $char." = ".$oct."\n"; | |
$chars[$oct] = $char; | |
} | |
$fileText = file_get_contents('_admin.php'); | |
$newText = $fileText; | |
foreach ($chars as $octCode => $charVal) { | |
$newText = str_replace("\\$octCode", $charVal, $newText, $count); | |
echo "\\$octCode - ".$count."\n"; | |
} | |
echo $newText; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment