3v4l.org

run code in 500+ 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:  18
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>
   11     2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          4        SEND_VAL                                                     ~5
          5        INIT_FCALL                                                   'array_keys'
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                             $6      
          8        SEND_VAR                                                     $6
          9        DO_ICALL                                             $7      
   12    10        INIT_FCALL                                                   'array_values'
         11        SEND_VAR                                                     !1
         12        DO_ICALL                                             $8      
   10    13        FRAMELESS_ICALL_3                str_replace         ~9      $7, $8
   13    14        OP_DATA                                                      !0
   10    15        ASSIGN                                                       !2, ~9
   16    16        ECHO                                                         !2
         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/9b7lO
function name:  {closure:/in/9b7lO:11}
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.5.0


preferences:
223.99 ms | 2059 KiB | 16 Q