pathdns)) != false) { // define pieces $piece = array(); $output = array(); $newline = "10.117.0.0 turnov.czf #255.255.0.0\n"; array_push($output, $newline); foreach ($contents as $k=>$line) { if (substr($line, 0, 1) == '=') { $piece = explode(':', $line); foreach ($piece as $k=>$v) { $v = trim($v); } $fqdn = substr_replace($piece[0], "", 0, 1); $ip = $piece[1]; $newline = $ip . "\t" . $fqdn . "\t" . "OKOFOLX\n"; array_push($output, $newline); } else { // don't bother because it's not we're after } } // foreach $contents file_put_contents($this->pathhosts, $output); } else { // do nothing } } } $myclass = new konvertorClass(); $myclass->start(); ?>