如何为我的应用程序的第二次运行保存日期

Here is what I did:

$time1 = date('h:i');
$time2 = null;
$time_array = array($time1, $time2);

$time1 is the current time. every time I run the script, it shows that moment.

I explain what I want to do:

at t=0 (initial) (first time I run the code)

$time1 = 10:14:26; (the date value that I want it to be saved for the use of the second run of the code)

I think you want to use session variables. But remember, if the user has cookies or private browsing enabled this will not work.

session_start();

if (isset($_SESSION['time_1'])) {
    $time2 = $_SESSION['time_1'];
}
$_SESSION['time_1'] = date('h:i');

$time_array = array($_SESSION['time_1'], $time2);