3v4l.org

run code in 300+ PHP versions simultaneously
<?php $message = "We have received ##AMOUNT## ##CURRENCY## for your OrderID n. ##ORDER_ID##"; $messageParameters = [ 'AMOUNT' => 83, 'CURRENCY' => 'USD', 'ORDER_ID' => 3271096 ]; $parsedMessage = str_replace( array_map(function($v){ return '##'.$v.'##'; }, array_keys($messageParameters)), array_values($messageParameters), $message ); echo $parsedMessage;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9b7lO
function name:  (null)
number of ops:  21
compiled vars:  !0 = $message, !1 = $messageParameters, !2 = $parsedMessage
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, <array>
   10     2        INIT_FCALL                                               'str_replace'
   11     3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          5        SEND_VAL                                                 ~5
          6        INIT_FCALL                                               'array_keys'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
   12    12        INIT_FCALL                                               'array_values'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $8      
         15        SEND_VAR                                                 $8
   13    16        SEND_VAR                                                 !0
   10    17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
   16    19        ECHO                                                     !2
         20      > 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/9b7lO
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 Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.56 ms | 1004 KiB | 17 Q