3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string); for ($i = 0; $i < round($strLength / 2); $i++) { var_dump($strLength-$i); var_dump($strLength / 2-$i); $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLength / 2 - $i]; } //var_dump($substr1); //var_dump($substr2); return $string = $substr1.$substr2; } var_dump(reverse('12345'));
based on Ur266
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/VLXM3
function name:  (null)
number of ops:  8
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  17     1        INIT_FCALL                                               'var_dump'
         2        INIT_FCALL                                               'reverse'
         3        SEND_VAL                                                 '12345'
         4        DO_FCALL                                      0  $0      
         5        SEND_VAR                                                 $0
         6        DO_ICALL                                                 
         7      > RETURN                                                   1

Function reverse:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 25
Branch analysis from position: 25
Jump found. Position 1 = 31, Position 2 = 7
Branch analysis from position: 31
Jump found. Position 1 = -2
Branch analysis from position: 7
Jump found. Position 1 = 31, Position 2 = 7
Branch analysis from position: 31
Branch analysis from position: 7
filename:       /in/VLXM3
function name:  reverse
number of ops:  35
compiled vars:  !0 = $string, !1 = $substr1, !2 = $substr2, !3 = $strLength, !4 = $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                                           ~7      !0
         4        ASSIGN                                                   !3, ~7
   6     5        ASSIGN                                                   !4, 0
         6      > JMP                                                      ->25
   7     7    >   INIT_FCALL                                               'var_dump'
         8        SUB                                              ~10     !3, !4
         9        SEND_VAL                                                 ~10
        10        DO_ICALL                                                 
   8    11        INIT_FCALL                                               'var_dump'
        12        DIV                                              ~12     !3, 2
        13        SUB                                              ~13     ~12, !4
        14        SEND_VAL                                                 ~13
        15        DO_ICALL                                                 
   9    16        SUB                                              ~15     !3, !4
        17        FETCH_DIM_R                                      $16     !0, ~15
        18        ASSIGN_CONCAT                                 0          !1, $16
  10    19        DIV                                              ~18     !3, 2
        20        SUB                                              ~19     ~18, !4
        21        FETCH_DIM_R                                      $20     !0, ~19
        22        ASSIGN_CONCAT                                 0          !2, $20
   6    23        POST_INC                                         ~22     !4
        24        FREE                                                     ~22
        25    >   INIT_FCALL                                               'round'
        26        DIV                                              ~23     !3, 2
        27        SEND_VAL                                                 ~23
        28        DO_ICALL                                         $24     
        29        IS_SMALLER                                       ~25     !4, $24
        30      > JMPNZ                                                    ~25, ->7
  14    31    >   CONCAT                                           ~26     !1, !2
        32        ASSIGN                                           $27     !0, ~26
        33      > RETURN                                                   $27
  15    34*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 7.2.0