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]; } if(is_null($count)) { return str_replace($needle,$replace,$haystack); } else { return 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/FnVem
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     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
   16     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 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/FnVem
function name:  mystr_replace
number of ops:  27
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    >   TYPE_CHECK                                    2          !4
         11      > JMPZ                                                     ~11, ->19
    9    12    >   INIT_FCALL                                               'str_replace'
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $12     
         17      > RETURN                                                   $12
         18*       JMP                                                      ->26
   11    19    >   INIT_FCALL                                               'str_replace'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !1
         22        SEND_VAR                                                 !2
         23        SEND_REF                                                 !4
         24        DO_ICALL                                         $13     
         25      > RETURN                                                   $13
   13    26*     > RETURN                                                   null

End of function mystr_replace

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.76 ms | 1403 KiB | 17 Q