Skip to content

Instantly share code, notes, and snippets.

@peledies
Created August 17, 2018 14:51
Show Gist options
  • Save peledies/6ffac49ddd1946b9daee4260e1438266 to your computer and use it in GitHub Desktop.
Save peledies/6ffac49ddd1946b9daee4260e1438266 to your computer and use it in GitHub Desktop.
private function parseVariables( $path )
{
$wpConfig = file_get_contents( $path );
preg_match_all("/[^#]define\('(.*?)',\s*'(.*)'\);/", $wpConfig, $matches);
for($c=0;$c<count($matches[1]);$c++) {
$values[$matches[1][$c]] = $matches[2][$c];
}
return $values;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment