3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "helloworld"; echo preg_replace('~.\L.~', ' ', $str); echo "\n---\n"; echo array_reduce(str_split($str, 2), function($carry, $item) { return $carry . $item[0] . (isset($item[1]) ? ' ' : ''); }); echo "\n---\n"; for ($offset = 1, $length = strlen($str); $offset < $length; $offset += 2) { $str[$offset] = ' '; } echo $str;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 23
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 23
Branch analysis from position: 28
Branch analysis from position: 23
filename:       /in/JuJkJ
function name:  (null)
number of ops:  30
compiled vars:  !0 = $str, !1 = $offset, !2 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'helloworld'
    5     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%7E.%5CL.%7E'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        ECHO                                                     $4
    7     7        ECHO                                                     '%0A---%0A'
    9     8        INIT_FCALL                                               'array_reduce'
          9        INIT_FCALL                                               'str_split'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
         14        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
   11    15        SEND_VAL                                                 ~6
    9    16        DO_ICALL                                         $7      
   11    17        ECHO                                                     $7
   13    18        ECHO                                                     '%0A---%0A'
   15    19        ASSIGN                                                   !1, 1
         20        STRLEN                                           ~9      !0
         21        ASSIGN                                                   !2, ~9
         22      > JMP                                                      ->26
   16    23    >   ASSIGN_DIM                                               !0, !1
         24        OP_DATA                                                  '+'
   15    25        ASSIGN_OP                                     1          !1, 2
         26    >   IS_SMALLER                                               !1, !2
         27      > JMPNZ                                                    ~13, ->23
   18    28    >   ECHO                                                     !0
   19    29      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JuJkJ
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $carry, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_DIM_R                                      ~2      !1, 0
          3        CONCAT                                           ~3      !0, ~2
          4        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 1
          5      > JMPZ                                                     ~4, ->8
          6    >   QM_ASSIGN                                        ~5      '+'
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      ''
          9    >   CONCAT                                           ~6      ~3, ~5
         10      > RETURN                                                   ~6
   11    11*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.84 ms | 969 KiB | 16 Q