3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mystr_replace($needle,$replace,$haystack){ $args = func_get_args(); $count=null; if(isset($args[3])){ $count &= $args[3]; } var_dump($args); if(is_null($count)) { return "3:".str_replace($needle,$replace,$haystack); } else { return "4:".str_replace($needle,$replace,$haystack,$count); } } echo mystr_replace("frop","frml","fropfrop")."\n"; echo mystr_replace("frop","frml","fropfrop",1)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R9isk
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'mystr_replace'
          1        SEND_VAL                                                 'frop'
          2        SEND_VAL                                                 'frml'
          3        SEND_VAL                                                 'fropfrop'
          4        DO_FCALL                                      0  $0      
          5        CONCAT                                           ~1      $0, '%0A'
          6        ECHO                                                     ~1
   17     7        INIT_FCALL                                               'mystr_replace'
          8        SEND_VAL                                                 'frop'
          9        SEND_VAL                                                 'frml'
         10        SEND_VAL                                                 'fropfrop'
         11        SEND_VAL                                                 1
         12        DO_FCALL                                      0  $2      
         13        CONCAT                                           ~3      $2, '%0A'
         14        ECHO                                                     ~3
         15      > RETURN                                                   1

Function mystr_replace:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/R9isk
function name:  mystr_replace
number of ops:  32
compiled vars:  !0 = $needle, !1 = $replace, !2 = $haystack, !3 = $args, !4 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    3     3        FUNC_GET_ARGS                                    ~5      
          4        ASSIGN                                                   !3, ~5
    4     5        ASSIGN                                                   !4, null
    5     6        ISSET_ISEMPTY_DIM_OBJ                         0          !3, 3
          7      > JMPZ                                                     ~8, ->10
    6     8    >   FETCH_DIM_R                                      ~9      !3, 3
          9        ASSIGN_OP                                    10          !4, ~9
    8    10    >   INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                                 
    9    13        TYPE_CHECK                                    2          !4
         14      > JMPZ                                                     ~12, ->23
   10    15    >   INIT_FCALL                                               'str_replace'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $13     
         20        CONCAT                                           ~14     '3%3A', $13
         21      > RETURN                                                   ~14
         22*       JMP                                                      ->31
   12    23    >   INIT_FCALL                                               'str_replace'
         24        SEND_VAR                                                 !0
         25        SEND_VAR                                                 !1
         26        SEND_VAR                                                 !2
         27        SEND_REF                                                 !4
         28        DO_ICALL                                         $15     
         29        CONCAT                                           ~16     '4%3A', $15
         30      > RETURN                                                   ~16
   14    31*     > RETURN                                                   null

End of function mystr_replace

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.29 ms | 1407 KiB | 19 Q