ich hab jetzt this->fcontent durch res_content ausgetauscht, die Datei test.dat mit dem Beispieldatensatz befüllt und das Skript laufen lassen
Ausgegeben wird
Was ist das Problem?
Code:
<?php $res_fcontent = array(); $file = 'test.dat'; $fp = fopen($file, "r"); $fcontent = fread($fp, filesize($file)); fclose($fp); $fcontent = explode("##########!", $fcontent); for($i=0;$i<count($fcontent);$i++) { $fcontent[$i] = explode("€€€€€", $fcontent[$i]); $fcontent[$i][2] = explode("&&&&&", $fcontent[$i][2]); for($j=0;$j<count($fcontent[$i][2]);$j++){ $fcontent[$i][2][$j] = explode("|||", $fcontent[$i][2][$j]); } switch($fcontent[$i][1]){ case 0: $res_fcontent["td"]["cat"][$fcontent[$i][0]] = $fcontent[$i][2]; break; case 1: $res_fcontent["td"]["note"][$fcontent[$i][0]] = $fcontent[$i][2]; break; default: $res_fcontent["td"]["cat"][$fcontent[$i][0]] = $fcontent[$i][2]; break; } } print_r($res_fcontent); ?>
Code:
Array ( [td] => Array ( [cat] => Array ( [0] => Array ( [0] => Array ( [0] => Aufgaben [1] => 1 [2] => - [3] => 27.10.2005 [4] => - [5] => - [6] => - [7] => - [8] => - ) ) [1] => Array ( [0] => Array ( [0] => TEST [1] => - [2] => - [3] => 27.10.2005 [4] => - [5] => - [6] => - [7] => - [8] => - ) [1] => Array ( [0] => TEST2 [1] => - [2] => - [3] => 27.10.2005 [4] => - [5] => - [6] => - [7] => - [8] => - ) ) ) ) )
Kommentar