Мое1 - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of Мое1.php

  1. <?php
  2. $start = "10:05";
  3. $end = "03:00";
  4. $time = strtotime(date('h:i'));
  5. if (strtotime($start) > strtotime($end)) {
  6.     $timestart = strtotime($start);
  7.     if ($time < $timestart) {
  8.         $timestart = strtotime('-1 days');
  9.         $timeend = strtotime($end);
  10.     } else {   
  11.         $timeend = strtotime("24:00") + strtotime($end) - strtotime("00:00");
  12.     }
  13. } else {
  14.     $timestart = strtotime($start);
  15.     $timeend = strtotime($end);
  16. }
  17. echo $timestart, "\n";
  18. echo $timeend, "\n";
  19. echo $time, "\n";
  20. echo date('h:i'), "\n";
  21. if ($time > $timestart && $time < $timeend) {
  22.     echo "работает!";
  23. } else {
  24.     echo "закрыто!";
  25. }
  26.  
File Description
  • Мое1
  • PHP Code
  • 21 Apr-2022
  • 640 Bytes
You can Share it: