$prog_file=1;
foreach ($_REQUEST as $key => $value) {
if (strpos($key, 'file') !== false) {
$output_file_origine = "\$output_".$prog_file;
echo $output_file_origine;
$$output_file_origine=array();
$riga=0;
set_time_limit(120);
$file_origine=$value;
$file_origine = fopen($file_origine, "r");
echo "<pre>";
while (!feof($file_origine)) {
$testo_riga = fgets($file_origine, 4096);
if (substr($testo_riga, 5, 2) != 'AB' && substr($testo_riga, 5, 2) != 'ab' && strlen($testo_riga)>1) {
$$output_file_origine+=crea_array_da_stringa($test o_riga, $array_campi_mazzettisti);
}
}
set_time_limit(15);
echo "</pre>";
fclose($file_origine);
}
++ $prog_file;
}
}
print_r(array_keys(get_defined_vars()));
echo "<hr>|||$output_file_origine<pre>".print_r($output _2,true)."---</pre>";
come autput della pagina ottengo questo:
================================================== ===================
$output_1
$output_2
Array ( [0] => GLOBALS [1] => _POST [2] => _GET [3] => _COOKIE [4] => _FILES [5] => _REQUEST [6] => stringa_input_tmp [7] => array_campi_mazzettisti [8] => prog_file [9] => value [10] => key [11] => output_file_origine [12] => $output_1 [13] => riga [14] => file_origine [15] => testo_riga [16] => $output_2 )
Notice: Undefined variable: output_2 in C:\Programmi\EasyPHP\www\intranet\prove\prova_syst em.php on line 114
|||$output_2
---
================================================== ===================
con questo script voglio creare degli array che cambiano nome in base ad un ciclo for
la funzione gira ma interrogando l'array $output2 (vedi ultima riga) non mi restituisce nulla
chiedevo anzitutto:
il mio approccio è corretto?
come posso ottenere l'array $output_1 e $output_2
spero di essermi spiegato in modo sufficientemente chiaro
grazie anticipatamente per le eventuali risposte