3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'ID' => 16, 'begin_date' => new \DateTime('2016-01-01 UTC'), 'end_date' => new \DateTime('2016-11-30 UTC'), ], [ 'ID' => 33, 'begin_date' => new \DateTime('2016-01-04 UTC'), 'end_date' => new \DateTime('2016-02-29 UTC'), ], ]; var_dump($data[0]['begin_date']['date']); function choose ($begin, $end) { $choice = null; if($begin > now()) { // condition one, cannot be leading, choose the other. $choice = $end; } if($start > now()) { //$choice } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OE7b7
function name:  (null)
number of ops:  28
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_ARRAY                                       ~1      16, 'ID'
    6     1        NEW                                              $2      'DateTime'
          2        SEND_VAL_EX                                              '2016-01-01+UTC'
          3        DO_FCALL                                      0          
          4        ADD_ARRAY_ELEMENT                                ~1      $2, 'begin_date'
    7     5        NEW                                              $4      'DateTime'
          6        SEND_VAL_EX                                              '2016-11-30+UTC'
          7        DO_FCALL                                      0          
          8        ADD_ARRAY_ELEMENT                                ~1      $4, 'end_date'
          9        INIT_ARRAY                                       ~6      ~1
   10    10        INIT_ARRAY                                       ~7      33, 'ID'
   11    11        NEW                                              $8      'DateTime'
         12        SEND_VAL_EX                                              '2016-01-04+UTC'
         13        DO_FCALL                                      0          
         14        ADD_ARRAY_ELEMENT                                ~7      $8, 'begin_date'
   12    15        NEW                                              $10     'DateTime'
         16        SEND_VAL_EX                                              '2016-02-29+UTC'
         17        DO_FCALL                                      0          
         18        ADD_ARRAY_ELEMENT                                ~7      $10, 'end_date'
         19        ADD_ARRAY_ELEMENT                                ~6      ~7
    3    20        ASSIGN                                                   !0, ~6
   16    21        INIT_FCALL                                               'var_dump'
         22        FETCH_DIM_R                                      ~13     !0, 0
         23        FETCH_DIM_R                                      ~14     ~13, 'begin_date'
         24        FETCH_DIM_R                                      ~15     ~14, 'date'
         25        SEND_VAL                                                 ~15
         26        DO_ICALL                                                 
   27    27      > RETURN                                                   1

Function choose:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 8
filename:       /in/OE7b7
function name:  choose
number of ops:  13
compiled vars:  !0 = $begin, !1 = $end, !2 = $choice, !3 = $start
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        ASSIGN                                                   !2, null
   20     3        INIT_FCALL_BY_NAME                                       'now'
          4        DO_FCALL                                      0  $5      
          5        IS_SMALLER                                               $5, !0
          6      > JMPZ                                                     ~6, ->8
   22     7    >   ASSIGN                                                   !2, !1
   24     8    >   INIT_FCALL_BY_NAME                                       'now'
          9        DO_FCALL                                      0  $8      
         10        IS_SMALLER                                               $8, !3
         11      > JMPZ                                                     ~9, ->12
   27    12    > > RETURN                                                   null

End of function choose

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.71 ms | 1400 KiB | 15 Q