3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replace_spaces ($text) { $replacement = function ($matches) { return str_replace ($matches[1], ' ', '&nbsp;').' '; }; return preg_replace_callback ('/( +) /', $replacement, $text); } echo replace_spaces('hello world');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbX9Q
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'replace_spaces'
          1        SEND_VAL                                                 'hello+world'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function replace_spaces:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbX9Q
function name:  replace_spaces
number of ops:  10
compiled vars:  !0 = $text, !1 = $replacement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJbX9Q%3A4%240'
          2        ASSIGN                                                   !1, ~2
    7     3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAL                                                 '%2F%28+%2B%29+%2F'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
    8     9*     > RETURN                                                   null

End of function replace_spaces

Function %00%7Bclosure%7D%2Fin%2FJbX9Q%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbX9Q
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'str_replace'
          2        FETCH_DIM_R                                      ~1      !0, 1
          3        SEND_VAL                                                 ~1
          4        SEND_VAL                                                 '+'
          5        SEND_VAL                                                 '%26nbsp%3B'
          6        DO_ICALL                                         $2      
          7        CONCAT                                           ~3      $2, '+'
          8      > RETURN                                                   ~3
    6     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJbX9Q%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.26 ms | 1399 KiB | 18 Q