xzczxcxc - 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 xzczxcxc.php

  1. <?php
  2.  
  3. var_dump(check_time_range('12:20', '08:20'));
  4.  
  5. function check_time_range($start, $end)
  6.     {
  7.         $startTime  = strtotime($start);
  8.         $endTime = strtotime($end);
  9.         $now = time();
  10.  
  11.         if ($startTime > $endTime){
  12.             $endTime = strtotime('+1 days', $endTime);
  13.              $now = strtotime('+1 days', $now);
  14.         }
  15.         
  16.         echo(date("Y-m-d H:i\n", $now));
  17.         echo(date("Y-m-d H:i\n", $endTime));
  18.         echo(date("Y-m-d H:i\n", $startTime));
  19.         return $now >= $startTime && $now <= $endTime;
  20.     }
File Description
  • xzczxcxc
  • PHP Code
  • 08 Jul-2020
  • 551 Bytes
You can Share it: