PO::export_to_file()publicWP 1.0

Same as export, but writes the result to a file

Method of the class: PO{}

No Hooks.

Return

true|false. true on success, false on error

Usage

$PO = new PO();
$PO->export_to_file( $filename, $include_headers );
$filename(string) (required)
Where to write the PO string.
$include_headers(true|false)
Whether to include the headers in the export.
Default: true

PO::export_to_file() code WP 6.1.1

public function export_to_file( $filename, $include_headers = true ) {
	$fh = fopen( $filename, 'w' );
	if ( false === $fh ) {
		return false;
	}
	$export = $this->export( $include_headers );
	$res    = fwrite( $fh, $export );
	if ( false === $res ) {
		return false;
	}
	return fclose( $fh );
}