3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "We have received ##AMOUNT## ##CURRENCY## for your OrderID n. ##ORDER_ID##"; $AMOUNT = 123; $CURRENCY = 'GBP'; $ORDER_ID = 20123; $find = ['AMOUNT', 'CURRENCY', 'ORDER_ID']; echo str_replace( array_map(function($v){ return '##'.$v.'##'; }, $find), compact(...$find), $str );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ekHYB
function name:  (null)
number of ops:  20
compiled vars:  !0 = $str, !1 = $AMOUNT, !2 = $CURRENCY, !3 = $ORDER_ID, !4 = $find
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, 'We+have+received+%23%23AMOUNT%23%23+%23%23CURRENCY%23%23+for+your+OrderID+n.+%23%23ORDER_ID%23%23'
   4     1        ASSIGN                                                   !1, 123
   5     2        ASSIGN                                                   !2, 'GBP'
   6     3        ASSIGN                                                   !3, 20123
   8     4        ASSIGN                                                   !4, <array>
  10     5        INIT_FCALL                                               'str_replace'
  11     6        INIT_FCALL                                               'array_map'
         7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FekHYB0x7f9e33c7a101'
         8        SEND_VAL                                                 ~10
         9        SEND_VAR                                                 !4
        10        DO_ICALL                                         $11     
        11        SEND_VAR                                                 $11
  12    12        INIT_FCALL                                               'compact'
        13        SEND_UNPACK                                              !4
        14        DO_ICALL                                         $12     
        15        SEND_VAR                                                 $12
  13    16        SEND_VAR                                                 !0
        17        DO_ICALL                                         $13     
        18        ECHO                                                     $13
  14    19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FekHYB0x7f9e33c7a101:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ekHYB
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $v
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  11     0  E >   RECV                                             !0      
         1        CONCAT                                           ~1      '%23%23', !0
         2        CONCAT                                           ~2      ~1, '%23%23'
         3      > RETURN                                                   ~2
         4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FekHYB0x7f9e33c7a101

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
14.14 ms | 411 KiB | 7 Q