array( "from" => dirname(__FILE__) . "/" . $mpbnFolder . "/resources/db/mysql/utf8/mysql_data.sql", "to" => dirname(__FILE__) . "/" . $mpbnFolder . "/resources/db/mysql/iso/mysql_data.sql"), "pgsql" => array( "from" => dirname(__FILE__) . "/" . $mpbnFolder . "/resources/db/postgresql/utf8/pgsql_data.sql", "to" => dirname(__FILE__) . "/" . $mpbnFolder . "/resources/db/postgresql/iso/pgsql_data.sql") ); function saveAsFile($filename, $data) { if ($h = fopen($filename, "w")) { if (!fwrite($h, $data)) { return false; } fclose($h); } return true; } foreach ($fileArray as $file) { $from = $file["from"]; $to = $file["to"]; if (file_exists($from)) { $data = file_get_contents($from); } else { echo "Fatal error: File not found ('" . $from . "').\n"; } $dataConverted = iconv("UTF-8", "ASCII//TRANSLIT", $data); if (!saveAsFile($to, $dataConverted)) { echo "Fatal error: File could not be saved ('" . $to . "').\n"; } } echo "Finished.\n\n"; ?>