3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parseDbString(string $value = 'Looking for a good {{ $pippo }}'){ $pippo='Pizza'; return preg_replace_callback('/{{(.*?)}}/', function($res) use ($pippo) { return "${trim($res[1])}"; // $val=${trim($res[1])}; Returns "Undefined variable: $pippo" $val=${trim($res[1])}; // Returns "Looking for a good Pizza" return isset($val) ? $val : $res[0]; },$value); } var_dump(parseDbString());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D2PG7
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'parsedbstring'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   1

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

End of function parsedbstring

Function %00%7Bclosure%7D%2Fin%2FD2PG7%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D2PG7
function name:  {closure}
number of ops:  23
compiled vars:  !0 = $res, !1 = $pippo, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    6     2        INIT_FCALL                                               'trim'
          3        FETCH_DIM_R                                      ~3      !0, 1
          4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
          6        FETCH_R                      local               ~5      $4
          7        CAST                                          6  ~6      ~5
          8      > RETURN                                                   ~6
    8     9*       INIT_FCALL                                               'trim'
         10*       FETCH_DIM_R                                      ~7      !0, 1
         11*       SEND_VAL                                                 ~7
         12*       DO_ICALL                                         $8      
         13*       FETCH_R                      local               ~9      $8
         14*       ASSIGN                                                   !2, ~9
    9    15*       ISSET_ISEMPTY_CV                                         !2
         16*       JMPZ                                                     ~11, ->19
         17*       QM_ASSIGN                                        ~12     !2
         18*       JMP                                                      ->21
         19*       FETCH_DIM_R                                      ~13     !0, 0
         20*       QM_ASSIGN                                        ~12     ~13
         21*       RETURN                                                   ~12
   10    22*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FD2PG7%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.5 ms | 1403 KiB | 20 Q