3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string); $strLengthHalf = round(strlen($string) / 2) - 1; var_dump($strLength); var_dump($strLengthHalf); for ($i = 0; $i <= $strLengthHalf; $i++) { $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLengthHalf - $i]; } var_dump($substr1); var_dump($substr2); 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/95Ad2
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     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 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 20
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 20
Branch analysis from position: 29
Branch analysis from position: 20
filename:       /in/95Ad2
function name:  reverse
number of ops:  39
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        INIT_FCALL                                               'round'
          6        STRLEN                                           ~10     !0
          7        DIV                                              ~11     ~10, 2
          8        SEND_VAL                                                 ~11
          9        DO_ICALL                                         $12     
         10        SUB                                              ~13     $12, 1
         11        ASSIGN                                                   !4, ~13
    7    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                                 
    8    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !4
         17        DO_ICALL                                                 
    9    18        ASSIGN                                                   !5, 0
         19      > JMP                                                      ->27
   10    20    >   SUB                                              ~18     !3, !5
         21        FETCH_DIM_R                                      ~19     !0, ~18
         22        ASSIGN_OP                                     8          !1, ~19
   11    23        SUB                                              ~21     !4, !5
         24        FETCH_DIM_R                                      ~22     !0, ~21
         25        ASSIGN_OP                                     8          !2, ~22
    9    26        PRE_INC                                                  !5
         27    >   IS_SMALLER_OR_EQUAL                                      !5, !4
         28      > JMPNZ                                                    ~25, ->20
   13    29    >   INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                                 
   14    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                                 
   15    35        CONCAT                                           ~28     !1, !2
         36        ASSIGN                                           ~29     !0, ~28
         37      > RETURN                                                   ~29
   16    38*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.75 ms | 1403 KiB | 18 Q