3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_multiple_replace($str, $needle, $subs) { return vsprintf(str_replace(array('%', $needle), array('%%', '%s'), $string), $subs); } $string = ">>>?<<<%%s>>>?<<<>>>?<<<"; echo str_multiple_replace($string, '?', array('Hello', 'World', '!'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cdu4s
function name:  (null)
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, '%3E%3E%3E%3F%3C%3C%3C%25%25s%3E%3E%3E%3F%3C%3C%3C%3E%3E%3E%3F%3C%3C%3C'
    8     1        INIT_FCALL                                               'str_multiple_replace'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3F'
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Function str_multiple_replace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cdu4s
function name:  str_multiple_replace
number of ops:  16
compiled vars:  !0 = $str, !1 = $needle, !2 = $subs, !3 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        INIT_FCALL                                               'vsprintf'
          4        INIT_FCALL                                               'str_replace'
          5        INIT_ARRAY                                       ~4      '%25'
          6        ADD_ARRAY_ELEMENT                                ~4      !1
          7        SEND_VAL                                                 ~4
          8        SEND_VAL                                                 <array>
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $5      
         11        SEND_VAR                                                 $5
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $6      
         14      > RETURN                                                   $6
    5    15*     > RETURN                                                   null

End of function str_multiple_replace

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.95 ms | 1397 KiB | 18 Q