Function __global->cms_fopen_text_read

Definitions

sources/files.php

  • {{creates-file}}Supports character set detection using BOM (which will then by bypassed from further reading).}}Supports character set detection using BOM (which will then by bypassed from further reading).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Flags:

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$path PATH No No required parameter N/A N/A File path
&$charset ?string Yes No required parameter N/A N/A Detected character set will be written into here (null: not set yet)
$locking boolean No No False N/A N/A File lock (if set, you must unlock with LOCK_UN before fclose)
$mode string No No rb N/A N/A Mode (e.g. at).
$default_charset ?string No No Null N/A N/A The default character set if none is specified (null: leave as null, ultimately meaning the default website character set will be used) (blank: smart detection)

Returns

  • The file handle (false: could not be opened)
  • Type: ~resource
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * {{creates-file}}Supports character set detection using BOM (which will then by bypassed from further reading).}}Supports character set detection using BOM (which will then by bypassed from further reading).
 *
 * @param  PATH $path File path
 * @param  ?string $charset Detected character set will be written into here (null: not set yet)
 * @param  boolean $locking File lock (if set, you must unlock with LOCK_UN before fclose)
 * @param  string $mode Mode (e.g. at).
 * @param  ?string $default_charset The default character set if none is specified (null: leave as null, ultimately meaning the default website character set will be used) (blank: smart detection)
 * @return ~resource The file handle (false: could not be opened)
 */

function cms_fopen_text_read(string $path, ?string &$charset, bool $locking = false, string $mode = 'rb', ?string $default_charset = null)