3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Str{ public function reverse($str){ $rtnString = ""; for($i = strlen($str)-1; $i >= 0; $i --){ $rtnString .= $str[$i]; } return $rtnString; } } $string = "abcde"; $strObj = new Str(); echo($strObj->reverse($string));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UP92Q
function name:  (null)
number of ops:  9
compiled vars:  !0 = $string, !1 = $strObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 'abcde'
   15     1        NEW                                              $3      'Str'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   16     4        INIT_METHOD_CALL                                         !1, 'reverse'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $6      
          7        ECHO                                                     $6
          8      > RETURN                                                   1

Class Str:
Function reverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 6
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 6
Branch analysis from position: 11
Branch analysis from position: 6
filename:       /in/UP92Q
function name:  reverse
number of ops:  13
compiled vars:  !0 = $str, !1 = $rtnString, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, ''
    6     2        STRLEN                                           ~4      !0
          3        SUB                                              ~5      ~4, 1
          4        ASSIGN                                                   !2, ~5
          5      > JMP                                                      ->9
    7     6    >   FETCH_DIM_R                                      ~7      !0, !2
          7        ASSIGN_OP                                     8          !1, ~7
    6     8        PRE_DEC                                                  !2
          9    >   IS_SMALLER_OR_EQUAL                                      0, !2
         10      > JMPNZ                                                    ~10, ->6
   10    11    > > RETURN                                                   !1
   11    12*     > RETURN                                                   null

End of function reverse

End of class Str.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.97 ms | 1394 KiB | 13 Q