get_random_file_content
get_random_file_content($folder,$ext,$include_subfolders,$timeout=60); - this function is used to get the contents of a random file in a given folder
The function accepts parameters as input:
$folder – path to the folder with files (string). It can be either absolute or relative (relative to the script folder).
$ext – file extensions to get the contents of. Extensions are separated from each other by ";", so the string "txt;php" - indicates that you need to select a random file among files with the extension txt and php (string). br>$include_subfolders – with true are utilized subfolders of the specified folder, with false - is searched only in the specified folder.
$timeout – maximum time for performing this operation (in seconds) default is 60 sec, if during this time the operation is finished, the script continues to be executed next.
After testing, the function returns the result of its work to the script :
content – contents of a randomly selected file from the specified folder (string) false – there are no files in the specified folder (boolean)