3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string); $strLengthHalf = intval(strlen($string) / 2); for ($i = 0; $i <= $strLengthHalf; $i++) { $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLengthHalf - $i]; } return $string = $substr1.$substr2; } var_dump(reverse('12345'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gfS8J
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'reverse'
          2        SEND_VAL                                                 '12345'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function reverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
Branch analysis from position: 11
filename:       /in/gfS8J
function name:  reverse
number of ops:  24
compiled vars:  !0 = $string, !1 = $substr1, !2 = $substr2, !3 = $strLength, !4 = $strLengthHalf, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, ''
    4     2        ASSIGN                                                   !2, ''
    5     3        STRLEN                                           ~8      !0
          4        ASSIGN                                                   !3, ~8
    6     5        STRLEN                                           ~10     !0
          6        DIV                                              ~11     ~10, 2
          7        CAST                                          4  ~12     ~11
          8        ASSIGN                                                   !4, ~12
    8     9        ASSIGN                                                   !5, 0
         10      > JMP                                                      ->18
    9    11    >   SUB                                              ~15     !3, !5
         12        FETCH_DIM_R                                      ~16     !0, ~15
         13        ASSIGN_OP                                     8          !1, ~16
   10    14        SUB                                              ~18     !4, !5
         15        FETCH_DIM_R                                      ~19     !0, ~18
         16        ASSIGN_OP                                     8          !2, ~19
    8    17        PRE_INC                                                  !5
         18    >   IS_SMALLER_OR_EQUAL                                      !5, !4
         19      > JMPNZ                                                    ~22, ->11
   13    20    >   CONCAT                                           ~23     !1, !2
         21        ASSIGN                                           ~24     !0, ~23
         22      > RETURN                                                   ~24
   14    23*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.61 ms | 1399 KiB | 16 Q