3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_reverse($string) { if (! is_string ( $string )) { exit ( 'not string' ); } $length = strlen ( $string ); $str_array = str_split ( $string ); $str_reverse = ''; for($i = $length - 1; $i >= 0; $i --) { $str_reverse .= $str_array [$i]; } echo $str_reverse; } $str = 'abcdef ss '; echo str_reverse ( $str );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FEZNJ
function name:  (null)
number of ops:  6
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 'abcdef++ss+'
   15     1        INIT_FCALL                                               'str_reverse'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function str_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 = 79) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 15
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 15
Branch analysis from position: 20
Branch analysis from position: 15
filename:       /in/FEZNJ
function name:  str_reverse
number of ops:  22
compiled vars:  !0 = $string, !1 = $length, !2 = $str_array, !3 = $str_reverse, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        TYPE_CHECK                                   64  ~5      !0
          2        BOOL_NOT                                         ~6      ~5
          3      > JMPZ                                                     ~6, ->5
    4     4    > > EXIT                                                     'not+string'
    6     5    >   STRLEN                                           ~7      !0
          6        ASSIGN                                                   !1, ~7
    7     7        INIT_FCALL                                               'str_split'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $9      
         10        ASSIGN                                                   !2, $9
    8    11        ASSIGN                                                   !3, ''
    9    12        SUB                                              ~12     !1, 1
         13        ASSIGN                                                   !4, ~12
         14      > JMP                                                      ->18
   10    15    >   FETCH_DIM_R                                      ~14     !2, !4
         16        ASSIGN_OP                                     8          !3, ~14
    9    17        PRE_DEC                                                  !4
         18    >   IS_SMALLER_OR_EQUAL                                      0, !4
         19      > JMPNZ                                                    ~17, ->15
   12    20    >   ECHO                                                     !3
   13    21      > RETURN                                                   null

End of function str_reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.16 ms | 1390 KiB | 16 Q