3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = "and with strange aeons even {{noun}} may {{verb}}"; $data = ['noun' => 'bird', 'verb' => 'fly']; $pattern = '/{{(' . implode('|', array_keys($data)) . ')}}/i'; echo preg_replace_callback($pattern, function($m) use($data){ return $data[strtolower($m[1])]; }, $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nrQ4t
function name:  (null)
number of ops:  18
compiled vars:  !0 = $str, !1 = $data, !2 = $pattern
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'and+with+strange+aeons+even+%7B%7Bnoun%7D%7D+may+%7B%7Bverb%7D%7D'
    4     1        ASSIGN                                                       !1, <array>
    6     2        INIT_FCALL                                                   'array_keys'
          3        SEND_VAR                                                     !1
          4        DO_ICALL                                             $5      
          5        FRAMELESS_ICALL_2                implode             ~6      '%7C', $5
          6        CONCAT                                               ~7      '%2F%7B%7B%28', ~6
          7        CONCAT                                               ~8      ~7, '%29%7D%7D%2Fi'
          8        ASSIGN                                                       !2, ~8
    7     9        INIT_FCALL                                                   'preg_replace_callback'
         10        SEND_VAR                                                     !2
         11        DECLARE_LAMBDA_FUNCTION                              ~10     [0]
         12        BIND_LEXICAL                                                 ~10, !1
    9    13        SEND_VAL                                                     ~10
         14        SEND_VAR                                                     !0
    7    15        DO_ICALL                                             $11     
    9    16        ECHO                                                         $11
         17      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nrQ4t
function name:  {closure:/in/nrQ4t:7}
number of ops:  9
compiled vars:  !0 = $m, !1 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
    8     2        INIT_FCALL                                                   'strtolower'
          3        FETCH_DIM_R                                          ~2      !0, 1
          4        SEND_VAL                                                     ~2
          5        DO_ICALL                                             $3      
          6        FETCH_DIM_R                                          ~4      !1, $3
          7      > RETURN                                                       ~4
    9     8*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
219.32 ms | 1976 KiB | 16 Q