123 - 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.
Result of php executing
Full code of 123.php
- <?php
- for ($i=1; $i<14; $i++) {
- for ($j=0; $j<24; $j++) {
- $h = $i;
- $k = $j+1;
- if ($i<10) {
- $fstDate ='0'.$i;
- } else {
- $fstDate =$i;
- }
- if ($j<10) {
- $fstHour ='0'.$j;
- }else {
- $fstHour =$j;
- }
- if ($k<10) {
- $secHour ='0'.$k;
- }else {
- $secHour =$k;
- }
- if ($k==24) {
- $secHour = '00';
- $h = $i+1;
- }
- if ($h<10) {
- $secDate ='0'.$h;
- } else {
- $secDate =$h;
- }
- echo "UNION (SELECT dttm, AVG(`r0`), AVG(`r1`), ((MAX(`r19`)-MIN(`r19`))/4.187), (MAX(`r11`)-MIN(`r11`)) FROM ((SELECT * FROM `all_data_device_4` WHERE `dttm` < '2023-09-".$fstDate." ".$fstHour.":00:00' ORDER BY `dttm` DESC LIMIT 1) UNION (SELECT * FROM `all_data_device_4` WHERE `dttm` BETWEEN '2023-09-".$fstDate." ".$fstHour.":00:00' AND '2023-09-".$secDate." ".$secHour.":00:00')) AS t1 ORDER BY `t1`.`dttm` DESC)" . "<br>";
- }
- }