3v4l.org

run code in 300+ PHP versions simultaneously
<?php function field_field($date, $field) { // Format yyyy-mm-dd or yyyy-mm or yyyy $length = strlen($date); if ( $length >= 4 ) { $year = substr($date, 0, 4); if ( $length >= 7 ) { $month = substr($date, 5, 2); if ( $length >= 9 ) { $day = substr($date, 8, 2); $start = "$year-$month-$day 00:00"; $day = str_pad(++$day,2,'0',STR_PAD_LEFT); $end = "$year-$month-$day 00:00"; } else { $start = "$year-$month-01 00:00"; $month = str_pad(++$month,2,'0',STR_PAD_LEFT); $end = "$year-$month-01 00:00"; } } else { $start = "$year-01-01 00:00"; $year = str_pad(++$year,2,'0',STR_PAD_LEFT); $end = "$year-01-01 00:00"; } return "$field >= '$start' AND $field < '$end'"; } else { return ' 1=1 '; } } echo field_field( '2010', 'me');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2VINe
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'field_field'
          1        SEND_VAL                                                 '2010'
          2        SEND_VAL                                                 'me'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function field_field:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 94
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 70
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 51
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 94
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2VINe
function name:  field_field
number of ops:  96
compiled vars:  !0 = $date, !1 = $field, !2 = $length, !3 = $year, !4 = $month, !5 = $day, !6 = $start, !7 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        STRLEN                                           ~8      !0
          3        ASSIGN                                                   !2, ~8
    6     4        IS_SMALLER_OR_EQUAL                                      4, !2
          5      > JMPZ                                                     ~10, ->94
    7     6    >   INIT_FCALL                                               'substr'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 0
          9        SEND_VAL                                                 4
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !3, $11
    8    12        IS_SMALLER_OR_EQUAL                                      7, !2
         13      > JMPZ                                                     ~13, ->70
    9    14    >   INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 5
         17        SEND_VAL                                                 2
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !4, $14
   10    20        IS_SMALLER_OR_EQUAL                                      9, !2
         21      > JMPZ                                                     ~16, ->51
   11    22    >   INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 8
         25        SEND_VAL                                                 2
         26        DO_ICALL                                         $17     
         27        ASSIGN                                                   !5, $17
   12    28        ROPE_INIT                                     6  ~20     !3
         29        ROPE_ADD                                      1  ~20     ~20, '-'
         30        ROPE_ADD                                      2  ~20     ~20, !4
         31        ROPE_ADD                                      3  ~20     ~20, '-'
         32        ROPE_ADD                                      4  ~20     ~20, !5
         33        ROPE_END                                      5  ~19     ~20, '+00%3A00'
         34        ASSIGN                                                   !6, ~19
   13    35        INIT_FCALL                                               'str_pad'
         36        PRE_INC                                          ~24     !5
         37        SEND_VAL                                                 ~24
         38        SEND_VAL                                                 2
         39        SEND_VAL                                                 '0'
         40        SEND_VAL                                                 0
         41        DO_ICALL                                         $25     
         42        ASSIGN                                                   !5, $25
   14    43        ROPE_INIT                                     6  ~28     !3
         44        ROPE_ADD                                      1  ~28     ~28, '-'
         45        ROPE_ADD                                      2  ~28     ~28, !4
         46        ROPE_ADD                                      3  ~28     ~28, '-'
         47        ROPE_ADD                                      4  ~28     ~28, !5
         48        ROPE_END                                      5  ~27     ~28, '+00%3A00'
         49        ASSIGN                                                   !7, ~27
         50      > JMP                                                      ->69
   16    51    >   ROPE_INIT                                     4  ~33     !3
         52        ROPE_ADD                                      1  ~33     ~33, '-'
         53        ROPE_ADD                                      2  ~33     ~33, !4
         54        ROPE_END                                      3  ~32     ~33, '-01+00%3A00'
         55        ASSIGN                                                   !6, ~32
   17    56        INIT_FCALL                                               'str_pad'
         57        PRE_INC                                          ~36     !4
         58        SEND_VAL                                                 ~36
         59        SEND_VAL                                                 2
         60        SEND_VAL                                                 '0'
         61        SEND_VAL                                                 0
         62        DO_ICALL                                         $37     
         63        ASSIGN                                                   !4, $37
   18    64        ROPE_INIT                                     4  ~40     !3
         65        ROPE_ADD                                      1  ~40     ~40, '-'
         66        ROPE_ADD                                      2  ~40     ~40, !4
         67        ROPE_END                                      3  ~39     ~40, '-01+00%3A00'
         68        ASSIGN                                                   !7, ~39
         69    > > JMP                                                      ->84
   21    70    >   NOP                                                      
         71        FAST_CONCAT                                      ~43     !3, '-01-01+00%3A00'
         72        ASSIGN                                                   !6, ~43
   22    73        INIT_FCALL                                               'str_pad'
         74        PRE_INC                                          ~45     !3
         75        SEND_VAL                                                 ~45
         76        SEND_VAL                                                 2
         77        SEND_VAL                                                 '0'
         78        SEND_VAL                                                 0
         79        DO_ICALL                                         $46     
         80        ASSIGN                                                   !3, $46
   23    81        NOP                                                      
         82        FAST_CONCAT                                      ~48     !3, '-01-01+00%3A00'
         83        ASSIGN                                                   !7, ~48
   25    84    >   ROPE_INIT                                     8  ~51     !1
         85        ROPE_ADD                                      1  ~51     ~51, '+%3E%3D+%27'
         86        ROPE_ADD                                      2  ~51     ~51, !6
         87        ROPE_ADD                                      3  ~51     ~51, '%27+AND+'
         88        ROPE_ADD                                      4  ~51     ~51, !1
         89        ROPE_ADD                                      5  ~51     ~51, '+%3C+%27'
         90        ROPE_ADD                                      6  ~51     ~51, !7
         91        ROPE_END                                      7  ~50     ~51, '%27'
         92      > RETURN                                                   ~50
         93*       JMP                                                      ->95
   27    94    > > RETURN                                                   '+1%3D1+'
   29    95*     > RETURN                                                   null

End of function field_field

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.52 ms | 1407 KiB | 18 Q