I have a function that writes it into a file.
public function write($type = "error", $mensaje = "") {
$this->file = fopen($this->filePath.$this->fileName, "a+");
if ($this->file == null) {
trigger_error("Error: No file", E_USER_ERROR);
} else {
fwrite($this->file, $type." ".$mensaje."\n");
}
}
I need to call this function from another php file say index.php
function test() {
write("testing done");
echo "done";
}
I want the write function to be called from index.php asynchronously so the current execution doesn't stop or block if the write fails.