3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getLineChartPromedio($format = 'Y-m-d'){ $startDate = '2020-07-08'; //$this->input->post('startDate'); $endDate = '2020-07-12'; //$this->input->post('endDate'); // Declare an empty array $arraydias = array(); // Variable that store the date interval // of period 1 day $interval = new DateInterval('P1D'); $realEnd = new DateTime($endDate); $realEnd->add($interval); $period = new DatePeriod(new DateTime($startDate), $interval, $realEnd); // Use loop to store date into array foreach($period as $date) { $fecha = $date->format($format); $arraydias[] = $fecha; } $string = "'" . implode("','", $arraydias) . "'"; echo json_encode($string); } getLineChartPromedio();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/upeIW
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'getlinechartpromedio'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function getlinechartpromedio:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 33
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/upeIW
function name:  getLineChartPromedio
number of ops:  46
compiled vars:  !0 = $format, !1 = $startDate, !2 = $endDate, !3 = $arraydias, !4 = $interval, !5 = $realEnd, !6 = $period, !7 = $date, !8 = $fecha, !9 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      'Y-m-d'
    4     1        ASSIGN                                                   !1, '2020-07-08'
    5     2        ASSIGN                                                   !2, '2020-07-12'
    7     3        ASSIGN                                                   !3, <array>
   11     4        NEW                                              $13     'DateInterval'
          5        SEND_VAL_EX                                              'P1D'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !4, $13
   13     8        NEW                                              $16     'DateTime'
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !5, $16
   14    12        INIT_METHOD_CALL                                         !5, 'add'
         13        SEND_VAR_EX                                              !4
         14        DO_FCALL                                      0          
   16    15        NEW                                              $20     'DatePeriod'
         16        NEW                                              $21     'DateTime'
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
         19        SEND_VAR_NO_REF_EX                                       $21
         20        SEND_VAR_EX                                              !4
         21        SEND_VAR_EX                                              !5
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !6, $20
   18    24      > FE_RESET_R                                       $25     !6, ->33
         25    > > FE_FETCH_R                                               $25, !7, ->33
   19    26    >   INIT_METHOD_CALL                                         !7, 'format'
         27        SEND_VAR_EX                                              !0
         28        DO_FCALL                                      0  $26     
         29        ASSIGN                                                   !8, $26
   20    30        ASSIGN_DIM                                               !3
         31        OP_DATA                                                  !8
   18    32      > JMP                                                      ->25
         33    >   FE_FREE                                                  $25
   23    34        INIT_FCALL                                               'implode'
         35        SEND_VAL                                                 '%27%2C%27'
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                         $29     
         38        CONCAT                                           ~30     '%27', $29
         39        CONCAT                                           ~31     ~30, '%27'
         40        ASSIGN                                                   !9, ~31
   24    41        INIT_FCALL                                               'json_encode'
         42        SEND_VAR                                                 !9
         43        DO_ICALL                                         $33     
         44        ECHO                                                     $33
   25    45      > RETURN                                                   null

End of function getlinechartpromedio

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.39 ms | 1441 KiB | 16 Q