'Create log error and php warning in root file

I created an smtp coding to send bulk emails and it was not a problem on the first day but at next day it slowed down or the emails were not sent and a log error appeared in my root file. error log:
PHP Warning: A non-numeric value encountered in /home/vodrllia/federalus-fedus3.xyz/email.php on line 19

where line 19 is

$rt = $rt+1;

and this lines up and down

$tts = 720;
while(true){
    if($tts>=720){
        $tts = 0;
        $rt = file_get_contents("runtime.txt");
        $rt = $rt+1;
        unlink("runtime.txt");
        $runtime = fopen("runtime.txt","w+");
        fwrite($runtime, $rt);
        fclose($runtime);
    

please help me to fix this error



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source