Last active
February 22, 2017 23:46
-
-
Save jameslkingsley/4869cf6b0640d4802da0f47486e5056a 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
public static function ext($file) | |
{ | |
$object = []; | |
$str = file_get_contents($file); | |
$isClass = false; | |
$dest = -1; | |
$className = ''; | |
for ($i = 0; $i <= strlen($str); $i++) { | |
$char = substr($str, $i, 1); | |
// echo $char; | |
if ($dest != -1 && $i != $dest) { | |
continue; | |
} | |
if ($char == ' ') { | |
continue; | |
} | |
if ($isClass) { | |
if ($char == ' ' || $char == '=') { | |
$isClass = false; | |
$object[$className] = []; | |
continue; | |
} | |
$className = $className . $char; | |
} | |
if ($char == 'c') { | |
echo substr($str, $i, 3); | |
if (substr($str, $i, 3) == 'class') { | |
$isClass = true; | |
$dest = $i + 3; | |
} | |
} | |
} | |
return $object; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment