3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string); $strLengthHalf = intval(strlen($string) / 2) - 1; 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/lbcIE
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 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 12
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 12
Branch analysis from position: 21
Branch analysis from position: 12
filename:       /in/lbcIE
function name:  reverse
number of ops:  25
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        SUB                                              ~13     ~12, 1
          9        ASSIGN                                                   !4, ~13
    8    10        ASSIGN                                                   !5, 0
         11      > JMP                                                      ->19
    9    12    >   SUB                                              ~16     !3, !5
         13        FETCH_DIM_R                                      ~17     !0, ~16
         14        ASSIGN_OP                                     8          !1, ~17
   10    15        SUB                                              ~19     !4, !5
         16        FETCH_DIM_R                                      ~20     !0, ~19
         17        ASSIGN_OP                                     8          !2, ~20
    8    18        PRE_INC                                                  !5
         19    >   IS_SMALLER_OR_EQUAL                                      !5, !4
         20      > JMPNZ                                                    ~23, ->12
   13    21    >   CONCAT                                           ~24     !1, !2
         22        ASSIGN                                           ~25     !0, ~24
         23      > RETURN                                                   ~25
   14    24*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.86 ms | 1398 KiB | 16 Q