Can I use file() or file_get_contents() to get a text file with an array inside and they use a foreach() to loop through the array like normal.
contents of the text file:
Array
(
[13] => Array
(
[desc] => Acrylic Awards
)
[9] => Array
(
[desc] => Completed Cups & Components
)
[15] => Array
(
[desc] => Drinkware
)
[6] => Array
(
[desc] => Economy Awards
)
[1] => Array
(
[desc] => Engraving Materials & Supplies
)
[14] => Array
(
[desc] => Frames
)
[11] => Array
(
[desc] => Gifts & Engravables
)
[12] => Array
(
[desc] => Glass & Crystal
)
[10] => Array
(
[desc] => Medals & Ribbons
)
[4] => Array
(
[desc] => Mylars & Inserts
)
[3] => Array
(
[desc] => Plaques & Accessories
)
[7] => Array
(
[desc] => Plastic Figures, Risers & Trim
)
[5] => Array
(
[desc] => Resin Trophies
)
[2] => Array
(
[desc] => Sublimation Materials & Supplies
)
[8] => Array
(
[desc] => Trophy Supplies
)
)
I've tested this:
$cacheDrill1 = 'cache/drill1.cache.php';
if(file_exists($cacheDrill1)){
$drill1 = array();
$drill1 = file_get_contents($cacheDrill1);
$drill1 = (array)$drill1;
}
foreach($drill1 as $a=>$b){...}
but get the following error: Warning: Invalid argument supplied for foreach().
I tried including the file as well but didn't have any luck.
I appreciate any insight. Thanks.