PHP code example of vitorbari / uptime-parser
1. Go to this page and download the library: Download vitorbari/uptime-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vitorbari / uptime-parser example snippets
use VitorBari\UptimeParser\Parser;
$uptime_output = 'SNMP OK - Timeticks: (197181577) 22 days, 19:43:35.77';
$uptime = Parser::uptime($uptime_output);
echo $uptime->days; // 22
echo $uptime->hours; // 547
echo $uptime->minutes; // 32863
echo $uptime->seconds; // 1971815
echo $uptime->toTimeString(); // '22 day(s), 19 hour(s), 43 minute(s) and 35 second(s)'
echo $uptime; // '22 day(s), 19 hour(s), 43 minute(s) and 35 second(s)'