Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. <?php
  2. $output = shell_exec ("last | head -10 | grep -ve reboot");
  3. $by_line_res = preg_split(("/\\n/"), $output);
  4.  
  5. for($i = 0; $i < 5; $i++) {
  6. preg_match("/ \d+:\d+/ ", $by_line_res[$i], $match);
  7. echo $match[0];
  8. echo " - ";
  9. preg_match("/\w+ /", $by_line_res[$i], $match);
  10. echo $match[0];
  11. echo " - ";
  12. echo "\n";
  13. }
  14. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement