3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "My starting year is {{current_year}} and my grad year is {{grad_year}}"; array_walk([ // List of placeholders and their values "{{current_year}}" => date("Y"), "{{grad_year}}" => date("Y") + 4 ], function($value, $key) use (&$string) { $string = str_replace($key, $value, $string); }); echo $string;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sN0H4
function name:  (null)
number of ops:  18
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'My+starting+year+is+%7B%7Bcurrent_year%7D%7D+and+my+grad+year+is+%7B%7Bgrad_year%7D%7D'
    4     1        INIT_FCALL                                               'array_walk'
    5     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'Y'
          4        DO_ICALL                                         $2      
          5        INIT_ARRAY                                       ~3      $2, '%7B%7Bcurrent_year%7D%7D'
    6     6        INIT_FCALL                                               'date'
          7        SEND_VAL                                                 'Y'
          8        DO_ICALL                                         $4      
          9        ADD                                              ~5      $4, 4
         10        ADD_ARRAY_ELEMENT                                ~3      ~5, '%7B%7Bgrad_year%7D%7D'
         11        SEND_VAL_EX                                              ~3
    7    12        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
         13        BIND_LEXICAL                                             ~6, !0
    9    14        SEND_VAL                                                 ~6
    4    15        DO_ICALL                                                 
   11    16        ECHO                                                     !0
   12    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/sN0H4
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $value, !1 = $key, !2 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    8     3        INIT_FCALL                                               'str_replace'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $3      
          8        ASSIGN                                                   !2, $3
    9     9      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.59 ms | 955 KiB | 16 Q