3v4l.org

run code in 300+ PHP versions simultaneously
<?php $r = specialSetStartEndDate(['H (Zeitraum)' => '2015-07 2015-09']); echo($r); function specialSetStartEndDate($values, $params) { assert(array_key_exists('H (Zeitraum)', $values)); $period = $values['H (Zeitraum)']; $dates = explode(' ', $period); $start_date = DateTime::createFromFormat('Y-d', $dates[0]); $end_date = DateTime::createFromFormat('Y-d', $dates[1]); if (false == $start_date || false == $end_date) { throw new EWDRMI_Exception("Invalid input format of date '$period'", EWDRMI_Exception::BREAK_ROW); } $start_date->modify('first day of'); $end_date->modify('last day of'); $result = array( 'start_date' => $start_date->format('Y-m-d'), 'end_date' => $end_date->format('Y-m-d'), ); return $result; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C7g72
function name:  (null)
number of ops:  6
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL_BY_NAME                                       'specialSetStartEndDate'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
    5     4        ECHO                                                     !0
   28     5      > RETURN                                                   1

Function specialsetstartenddate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 41
Branch analysis from position: 32
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/C7g72
function name:  specialSetStartEndDate
number of ops:  58
compiled vars:  !0 = $values, !1 = $params, !2 = $period, !3 = $dates, !4 = $start_date, !5 = $end_date, !6 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ASSERT_CHECK                                             
          3        INIT_FCALL                                               'assert'
          4        ARRAY_KEY_EXISTS                                 ~7      'H+%28Zeitraum%29', !0
          5        SEND_VAL                                                 ~7
          6        SEND_VAL                                                 'assert%28array_key_exists%28%27H+%28Zeitraum%29%27%2C+%24values%29%29'
          7        DO_ICALL                                                 
   11     8        FETCH_DIM_R                                      ~9      !0, 'H+%28Zeitraum%29'
          9        ASSIGN                                                   !2, ~9
   12    10        INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '+'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !3, $11
   14    15        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         16        SEND_VAL                                                 'Y-d'
         17        FETCH_DIM_R                                      ~13     !3, 0
         18        SEND_VAL                                                 ~13
         19        DO_FCALL                                      0  $14     
         20        ASSIGN                                                   !4, $14
   15    21        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         22        SEND_VAL                                                 'Y-d'
         23        FETCH_DIM_R                                      ~16     !3, 1
         24        SEND_VAL                                                 ~16
         25        DO_FCALL                                      0  $17     
         26        ASSIGN                                                   !5, $17
   16    27        BOOL_NOT                                         ~19     !4
         28      > JMPNZ_EX                                         ~19     ~19, ->31
         29    >   BOOL_NOT                                         ~20     !5
         30        BOOL                                             ~19     ~20
         31    > > JMPZ                                                     ~19, ->41
   17    32    >   NEW                                              $21     'EWDRMI_Exception'
         33        ROPE_INIT                                     3  ~23     'Invalid+input+format+of+date+%27'
         34        ROPE_ADD                                      1  ~23     ~23, !2
         35        ROPE_END                                      2  ~22     ~23, '%27'
         36        SEND_VAL_EX                                              ~22
         37        FETCH_CLASS_CONSTANT                             ~25     'EWDRMI_Exception', 'BREAK_ROW'
         38        SEND_VAL_EX                                              ~25
         39        DO_FCALL                                      0          
         40      > THROW                                         0          $21
   20    41    >   INIT_METHOD_CALL                                         !4, 'modify'
         42        SEND_VAL_EX                                              'first+day+of'
         43        DO_FCALL                                      0          
   21    44        INIT_METHOD_CALL                                         !5, 'modify'
         45        SEND_VAL_EX                                              'last+day+of'
         46        DO_FCALL                                      0          
   24    47        INIT_METHOD_CALL                                         !4, 'format'
         48        SEND_VAL_EX                                              'Y-m-d'
         49        DO_FCALL                                      0  $29     
         50        INIT_ARRAY                                       ~30     $29, 'start_date'
   25    51        INIT_METHOD_CALL                                         !5, 'format'
         52        SEND_VAL_EX                                              'Y-m-d'
         53        DO_FCALL                                      0  $31     
         54        ADD_ARRAY_ELEMENT                                ~30     $31, 'end_date'
   23    55        ASSIGN                                                   !6, ~30
   27    56      > RETURN                                                   !6
   28    57*     > RETURN                                                   null

End of function specialsetstartenddate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.17 ms | 1400 KiB | 17 Q