3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($str) { if (strlen($str) < 2) { return $str; } return reverse(substr($str, 1)) . $str[0]; } $txt = "Thomas"; echo rev($txt);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UXAOA
function name:  (null)
number of ops:  6
compiled vars:  !0 = $txt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, 'Thomas'
   13     1        INIT_FCALL_BY_NAME                                       'rev'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function reverse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UXAOA
function name:  reverse
number of ops:  16
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                               ~1, 2
          3      > JMPZ                                                     ~2, ->5
    6     4    > > RETURN                                                   !0
    9     5    >   INIT_FCALL_BY_NAME                                       'reverse'
          6        INIT_FCALL                                               'substr'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $3      
         10        SEND_VAR_NO_REF_EX                                       $3
         11        DO_FCALL                                      0  $4      
         12        FETCH_DIM_R                                      ~5      !0, 0
         13        CONCAT                                           ~6      $4, ~5
         14      > RETURN                                                   ~6
   10    15*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.95 ms | 1395 KiB | 15 Q