3v4l.org

run code in 500+ PHP versions simultaneously
<?php function parseDbString(string $value = 'Looking for a good {{ $pippo }}'){ global $pippo; $pippo = 'Pizza'; return preg_replace_callback('/{{ \$(.*?) }}/', function($m) use ($pippo) { echo "Global: " , $GLOBALS['pippo']; echo "\n{$m[1]}\n"; return $GLOBALS[$m[1]] ?? $m[0]; // null coalescing operator provides fallback },$value); } echo parseDbString();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HJL6s
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                                   'parsedbstring'
          1        DO_FCALL                                          0  $0      
          2        ECHO                                                         $0
          3      > RETURN                                                       1

Function parsedbstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HJL6s
function name:  parseDbString
number of ops:  12
compiled vars:  !0 = $value, !1 = $pippo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                            !0      'Looking+for+a+good+%7B%7B+%24pippo+%7D%7D'
    3     1        BIND_GLOBAL                                                  !1, 'pippo'
    4     2        ASSIGN                                                       !1, 'Pizza'
    5     3        INIT_FCALL                                                   'preg_replace_callback'
          4        SEND_VAL                                                     '%2F%7B%7B+%5C%24%28.%2A%3F%29+%7D%7D%2F'
          5        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
          6        BIND_LEXICAL                                                 ~3, !1
    9     7        SEND_VAL                                                     ~3
          8        SEND_VAR                                                     !0
    5     9        DO_ICALL                                             $4      
    9    10      > RETURN                                                       $4
   10    11*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HJL6s
function name:  {closure:parseDbString():5}
number of ops:  17
compiled vars:  !0 = $m, !1 = $pippo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
    6     2        ECHO                                                         'Global%3A+'
          3        FETCH_R                          global              ~2      'pippo'
          4        ECHO                                                         ~2
    7     5        ROPE_INIT                                         3  ~5      '%0A'
          6        FETCH_DIM_R                                          ~3      !0, 1
          7        ROPE_ADD                                          1  ~5      ~5, ~3
          8        ROPE_END                                          2  ~4      ~5, '%0A'
          9        ECHO                                                         ~4
    8    10        FETCH_DIM_R                                          ~7      !0, 1
         11        FETCH_IS                                             ~8      ~7
         12        COALESCE                                             ~9      ~8
         13        FETCH_DIM_R                                          ~10     !0, 0
         14        QM_ASSIGN                                            ~9      ~10
         15      > RETURN                                                       ~9
    9    16*     > RETURN                                                       null

End of Dynamic Function 0

End of function parsedbstring

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.19 ms | 2076 KiB | 15 Q