Function __global->cms_file_safe

Definitions

sources/global3.php

  • Reads entire file into an array.Supports locking and character set conversion (using BOMs).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$path PATH No No required parameter N/A N/A File path
$default_charset ?string No No Null N/A N/A The default character set if none is specified (null: website character set)

Returns

  • The array (each line being an entry in the array, and newlines still attached) (false: error)
  • Type: ~array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Reads entire file into an array.Supports locking and character set conversion (using BOMs).
 *
 * @param  PATH $path File path
 * @param  ?string $default_charset The default character set if none is specified (null: website character set)
 * @return ~array The array (each line being an entry in the array, and newlines still attached) (false: error)
 */

function cms_file_safe(string $path, ?string $default_charset = null)