zygo_test_average - 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 zygo_test_average.php
- <?php
- $XTELE_DATA=array(
- '2021-03-01 13:00:00',
- '2021-03-01 13:00:27',
- '2021-03-01 13:00:45',
- '2021-03-01 13:01:03',
- '2021-03-01 13:01:21',
- '2021-03-01 13:01:39',
- '2021-03-01 13:01:57',
- '2021-03-01 13:02:15',
- '2021-03-01 13:02:29',
- '2021-03-01 13:02:45',
- '2021-03-01 13:03:03','2021-03-01 13:03:21','2021-03-01 13:03:42','2021-03-01 13:04:12','2021-03-01 13:04:45','2021-03-01 13:05:17','2021-03-01 13:05:49','2021-03-01 13:06:20','2021-03-01 13:06:54','2021-03-01 13:07:27','2021-03-01 13:08:04','2021-03-01 13:08:38','2021-03-01 13:09:10','2021-03-01 13:09:34','2021-03-01 13:09:51','2021-03-01 13:10:15','2021-03-01 13:10:48','2021-03-01 13:11:09','2021-03-01 13:11:52','2021-03-01 13:12:38','2021-03-01 13:13:21','2021-03-01 13:14:05','2021-03-01 13:14:50','2021-03-01 13:15:32','2021-03-01 13:16:12','2021-03-01 13:16:56','2021-03-01 13:17:39','2021-03-01 13:18:24','2021-03-01 13:19:11','2021-03-01 13:19:56','2021-03-01 13:20:53','2021-03-01 13:21:34','2021-03-01 13:22:18','2021-03-01 13:24:34','2021-03-01 13:25:19','2021-03-01 13:26:03','2021-03-01 13:26:56','2021-03-01 13:27:43','2021-03-01 13:28:31','2021-03-01 13:29:20','2021-03-01 13:30:55','2021-03-01 13:31:40','2021-03-01 13:32:28','2021-03-01 13:33:17');
- $XTELE_OFFSET=array('0','6','0','1','1','1','1','8','5','1','2','-1','0','2','5','-1','2','1','4','7','1','3','5','-1','5','3','0','2','9','3','9','6','13','14','8','4','9','1','9','11','8','7','9','5','2','8','3','6','1','0','11','1','4','1');
- $count=sizeof($XTELE_DATA);
- if($count){
- $sec = 10;
- $xdata=array();
- $xoff=array();
- $mvals=array();
- $dtInit = NULL;
- foreach($XTELE_DATA as $k=>$rdata){ //while ($row = $resultChart->fetch_object()){
- $roffset= $XTELE_OFFSET[$k]; //$row->offset;
- //$rdata= $row->data;
- if($roffset!==NULL){
- $xdata[]=$rdata;
- $xoff[]=$roffset;
- if($dtInit==NULL){
- $dtInit = new DateTime($rdata);
- }else{
- $curdt = new DateTime($rdata);
- $diff = date_diff($dtInit, $curdt);
- $total = ((($diff->y * 365.25 + $diff->m * 30 + $diff->d) * 24 + $diff->h) * 60 + $diff->i)*60 + $diff->s;
- $mm = floor($total/$sec);
- if(!isset($mvals[$mm]))
- $mvals[$mm]=0;
- $mvals[$mm]+=$roffset;
- echo $mm." - ".$roffset." - ".$total."\n";
- }
- }
- }
- /*
- $dt2 = $dt1->add(new DateInterval('PT'.$sec.'S'));
- $dt1 = new DateTime('2021-02-26 06:02:23');
- $xz = $dt1->add(new DateInterval('PT'.$sec.'S'));
- echo "ZZ". $xz->format('H:i:s');
- $dt2 = new DateTime('2021-02-26 06:05:51');
- $diff = date_diff($dt1, $dt2);
- $total = ((($diff->y * 365.25 + $diff->m * 30 + $diff->d) * 24 + $diff->h) * 60 + $diff->i)*60 + $diff->s;
- echo $total;*/
- echo "\nvar XTELE_DATA=['".implode("','", $xdata)."'];";
- echo "\nvar XTELE_OFFSET=['".implode("','", $xoff)."'];";
- echo "\nvar MVALS={";
- foreach($mvals as $m=>$v){
- echo "'".$m."' : '".$v."', ";
- }
- echo "};";
- }
File Description
- zygo_test_average
- PHP Code
- 01 Mar-2021
- 3.21 Kb
You can Share it:
Latest PHP Pastes