3v4l.org

run code in 300+ PHP versions simultaneously
<?php function StripExtraSpace($s) { $newstr = ""; for($i = 0; $i < strlen($s); $i++) { $newstr = $newstr . substr($s, $i, 1); if(substr($s, $i, 1) == ' ') while(substr($s, $i + 1, 1) == ' ') $i++; } return $newstr; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mb39L
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   1

Function stripextraspace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 4
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 28
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 19
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 4
Branch analysis from position: 32
Branch analysis from position: 4
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 19
Branch analysis from position: 28
Branch analysis from position: 19
Branch analysis from position: 28
filename:       /in/mb39L
function name:  StripExtraSpace
number of ops:  34
compiled vars:  !0 = $s, !1 = $newstr, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->29
    8     4    >   INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !2
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $5      
          9        CONCAT                                           ~6      !1, $5
         10        ASSIGN                                                   !1, ~6
    9    11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 1
         15        DO_ICALL                                         $8      
         16        IS_EQUAL                                                 $8, '+'
         17      > JMPZ                                                     ~9, ->28
   10    18    > > JMP                                                      ->20
   11    19    >   PRE_INC                                                  !2
   10    20    >   INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !0
         22        ADD                                              ~11     !2, 1
         23        SEND_VAL                                                 ~11
         24        SEND_VAL                                                 1
         25        DO_ICALL                                         $12     
         26        IS_EQUAL                                                 $12, '+'
         27      > JMPNZ                                                    ~13, ->19
    6    28    >   PRE_INC                                                  !2
         29    >   STRLEN                                           ~15     !0
         30        IS_SMALLER                                               !2, ~15
         31      > JMPNZ                                                    ~16, ->4
   13    32    > > RETURN                                                   !1
   14    33*     > RETURN                                                   null

End of function stripextraspace

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.1 ms | 945 KiB | 16 Q