arrays - Import an externally hosted txt file (on github) as PHP code -


i have txt file on github i'd bring php code.

the txt file array of arrays, written in proper php syntax. example:

<?php $data = []; $data[101] = [   "key1" => "value1",   "key2" => "value2" ]; $data[102] = [ "key1" => "value1",   "key2" => "value2" ]; ?> 

i've tried few different methods, including file_get_contents(), file(), , fopen/fread/fclose. each time results in array being broken down more arrays. seems though pulling github code, result difficult manage.

so, question is: possible import externally hosted text file php code without breaking down arrays or converting strings?

maybe there better method solving problem, believe can accomplished. appreciated!


Comments