i think it is better to store your values in a more simple format
mydata.php
<?php exit; ?>
1114_##_780_##_781_##_1253_##_128
and retrieve it with
<?php
$data = file_get_contents( 'mydata.php' );
$my_rows = explode( "\n", str_replace( "\r\n", "\n", $data )); //2 rows in array
$my_array = explode( "_##_", $my_rows[1] ); //an array of values in row 2
foreach( $my_array AS $value ){
echo $value. '<br>';
}
?>
.....to store the data:
1. $row[0] = '<?php exit; ?>';
2. $row[1] = implode array with your values using '##'
3. $data = implode $row with "\n";
4. file_put_contents ( 'mydata.php', $data );
Regards 🙂
PS.
If you want, you can create 2 functions, using the above
<?php
function save_array( $filename, $array ) {
$row[0] = = '<?php exit; ?>';
// etc
// etc
file_put_contents ( $filename, $data );
}
function load_array( $filename ) {
$data = file_get_contents( $filename );
// etc
// etc
return $my_array;
}
?>
.... and use it like this
<?php
$arr = array( 345, 5789, 43, 150, 911 );
save_array( 'mydata.php', $arr );
$some_array = load_array( 'mydata.php' );
echo '<pre>' .print_r( $some_array, true ). '</pre>';
?>