set_string_to_file
set_string_to_file($file,$str,$line,$add=true,$timeout=COMMAND_TIME); - set (change or add) the specified string in the file
The function accepts parameters as input:
$file – path to the file where the string should be set. It can be either absolute or relative (relative to the script folder).
$str – the string to set in the file
$line – the number of the specified line in the file (line numbering, as everywhere, starts from zero)
$add – the string will be added to the file (true) or replace the old string (false)
$timeout – the maximum time to perform this operation (in seconds), by default - 60 seconds, if the operation is not completed during this time, the script continues to run further.
After testing, the function returns the result of its work to the script :
true – operation completed (boolean) false – operation failed (boolean)