3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($str) { if (strlen($str) < 2) { return $str; } println($str[0]); return reverse(substr($str, 1)) . $str[0]; } $txt = "Thomas"; echo reverse($txt);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jPoOg
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                                               'reverse'
          2        SEND_VAR                                                 !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/jPoOg
function name:  reverse
number of ops:  21
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
    8     5    >   INIT_FCALL_BY_NAME                                       'println'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_DIM_FUNC_ARG                               $3      !0, 0
          8        SEND_FUNC_ARG                                            $3
          9        DO_FCALL                                      0          
    9    10        INIT_FCALL_BY_NAME                                       'reverse'
         11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $5      
         15        SEND_VAR_NO_REF_EX                                       $5
         16        DO_FCALL                                      0  $6      
         17        FETCH_DIM_R                                      ~7      !0, 0
         18        CONCAT                                           ~8      $6, ~7
         19      > RETURN                                                   ~8
   10    20*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.28 ms | 1399 KiB | 16 Q