3v4l.org

run code in 300+ PHP versions simultaneously
<?php function blah($days){ if($days < 7) return "$days days"; if($days <= 31) return (int)($days / 7) . " weeks"; if($days <= 365) return (int)($days / 30) . " months"; return (int)($days / 365) . " years"; } echo blah (5) . "\n"; echo blah (25) . "\n"; echo blah (225) . "\n"; echo blah (2225) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/loqXC
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'blah'
          1        SEND_VAL                                                 5
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   11     5        INIT_FCALL                                               'blah'
          6        SEND_VAL                                                 25
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
   12    10        INIT_FCALL                                               'blah'
         11        SEND_VAL                                                 225
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
   13    15        INIT_FCALL                                               'blah'
         16        SEND_VAL                                                 2225
         17        DO_FCALL                                      0  $6      
         18        CONCAT                                           ~7      $6, '%0A'
         19        ECHO                                                     ~7
         20      > RETURN                                                   1

Function blah:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/loqXC
function name:  blah
number of ops:  23
compiled vars:  !0 = $days
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        IS_SMALLER                                               !0, 7
          2      > JMPZ                                                     ~1, ->6
          3    >   NOP                                                      
          4        FAST_CONCAT                                      ~2      !0, '+days'
          5      > RETURN                                                   ~2
    5     6    >   IS_SMALLER_OR_EQUAL                                      !0, 31
          7      > JMPZ                                                     ~3, ->12
          8    >   DIV                                              ~4      !0, 7
          9        CAST                                          4  ~5      ~4
         10        CONCAT                                           ~6      ~5, '+weeks'
         11      > RETURN                                                   ~6
    6    12    >   IS_SMALLER_OR_EQUAL                                      !0, 365
         13      > JMPZ                                                     ~7, ->18
         14    >   DIV                                              ~8      !0, 30
         15        CAST                                          4  ~9      ~8
         16        CONCAT                                           ~10     ~9, '+months'
         17      > RETURN                                                   ~10
    7    18    >   DIV                                              ~11     !0, 365
         19        CAST                                          4  ~12     ~11
         20        CONCAT                                           ~13     ~12, '+years'
         21      > RETURN                                                   ~13
    8    22*     > RETURN                                                   null

End of function blah

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.69 ms | 1403 KiB | 17 Q