How can PHP be used to retrieve the last system startup time using WMI?

To retrieve the last system startup time using WMI in PHP, we can utilize the `COM` class to interact with WMI objects. We need to query the `Win32_OperatingSystem` class and retrieve the `LastBootUpTime` property to get the system startup time. By parsing the returned date/time string, we can convert it into a more readable format.

<?php
$wmi = new COM('winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2');
$os = $wmi->ExecQuery('SELECT LastBootUpTime FROM Win32_OperatingSystem');
foreach ($os as $obj) {
    $lastBootUpTime = $obj->LastBootUpTime;
    $lastBootUpTime = preg_replace('/(\.\d+)?\+(\d+)$/', '', $lastBootUpTime);
    $lastBootUpTime = date('Y-m-d H:i:s', strtotime($lastBootUpTime));
    echo "Last system startup time: $lastBootUpTime";
}
?>