\IncludesFile

Functions for operating on files.

Summary

Methods
Properties
Constants
saveArrayToFile()
checkIfFileExistsAndDeleteContent()
createMissingDirectory()
getArrayFromFile()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

saveArrayToFile()

saveArrayToFile(array  $array, string  $filename, string  $fileExtension = '.dat', string|mixed  $delimiter = ' ') 

Save array to file.

Parameters

array $array

Array to sort

string $filename

Filename without extension

string $fileExtension

File extension. Default is '.dat'

string|mixed $delimiter

Delimiter. Default is ' '

checkIfFileExistsAndDeleteContent()

checkIfFileExistsAndDeleteContent(string  $filename, string  $fileExtension = '.dat') 

Warn about overwriting file if exists and empty it.

Parameters

string $filename

Filename without extension

string $fileExtension

File extension. Default is '.dat'

createMissingDirectory()

createMissingDirectory(string  $filename) 

Create dir from filename if not exists.

Parameters

string $filename

Filename

getArrayFromFile()

getArrayFromFile(string  $filename, string  $fileExtension = '.dat', string|mixed  $delimiter = ' ') : array

Get array from file content.

Parameters

string $filename

Filename without extension

string $fileExtension

File extension. Default is '.dat'

string|mixed $delimiter

Delimiter. Default is ' '

Returns

array