if condition not work wiht very large file in php -
i need read file server , boucle file read need. before condition if display work fine case large file or small. inside if not work large file. php code. first, use get_contents_file not wokr , change fread not work large files.
<!-- language: lang-html --> function test_funct_campg($id_campg_x){ $dir = new directoryiterator("/var/log/test/"); ; foreach ($dir $file) { if ($file->isfile()){ if(preg_match('#actyn-#i', $file)){ ini_set("memory_limit","70000m"); $f = fopen($file->getfileinfo(), 'r'); $contents = fread($f, filesize($file->getfileinfo())); //fclose($f); $table = explode("\n", $contents); foreach ($table $row) { $str=explode('"', $row); $row=$str[0].$str[2]; $fields=explode(',', $row); $email_address=$fields[5]; $test_error=$fields[9]; $id_campg=$fields[20]; // echo count($fields[20]); print_r($id_campg);// work in case large file or small display same id id_campg if($id_campg==$id_campg_x){ //$id_campg_x variable passed function print_r($id_campg); // work f fie not large } } } } } } enter code here
Comments
Post a Comment