Skip to content

Instantly share code, notes, and snippets.

@rydurham
Last active May 28, 2020 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rydurham/715a104ed965aae86f28b7d3eaa074c2 to your computer and use it in GitHub Desktop.
Save rydurham/715a104ed965aae86f28b7d3eaa074c2 to your computer and use it in GitHub Desktop.
Print a PHP array so that it can be copied into source code
<?
foreach($this->parser->getRecords() as $ref => $record) {
echo "'{$ref}' => [\n";
foreach($record as $key => $value) {
if (is_float($value)) {
echo " '{$key}' => {$value},\n";
} else {
echo " '{$key}' => '{$value}',\n";
}
}
echo "],\n";
}
die();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment