This allows me to pull stuff from various APIs and then just store in in one flat .php file to use repeatable in a project. This way you can just make one API call, get the data once, store it in one file and then have very quick access to that data … it’s like a caching system of sorts.
function array_creator($thearray, $name) {
echo "\n";
echo "\n";
echo "'$name' => array(";
echo "\n";
echo "\n";
$c = 0;
// print_r($columns);
//echo 'test';
$c = 0;
foreach ($thearray as $value)
{
if ($c > 0) {
echo ' \''.$c.'\' => \''.addslashes($value).'\',';
echo "\n";
}
$c++;
}
echo "\n";
echo "\n";
echo '),';
echo "\n";
echo "\n";
echo "\n";
}