3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = array('fookey', 'foobaz', 'fooloo' => 'fooboo'); function my_replace_array($array,$key,$val){ for($i=0;$i<count($array);$i++){ if(is_array($array[$i])){ $array[$i] = my_replace_array($array[$i],$key,$val); }else{ $array[$i]=str_replace($key,$val,$array[$i]); } } return $array; } var_export( my_replace_array($array, 'foo', 'bar') );

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bqQc7
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   16     1        INIT_FCALL                                                   'var_export'
   17     2        INIT_FCALL                                                   'my_replace_array'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     'foo'
          5        SEND_VAL                                                     'bar'
          6        DO_FCALL                                          0  $2      
          7        SEND_VAR                                                     $2
   16     8        DO_ICALL                                                     
   18     9      > RETURN                                                       1

Function my_replace_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 5
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 5
Branch analysis from position: 27
Branch analysis from position: 5
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 5
Branch analysis from position: 27
Branch analysis from position: 5
filename:       /in/bqQc7
function name:  my_replace_array
number of ops:  29
compiled vars:  !0 = $array, !1 = $key, !2 = $val, !3 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
    6     3        ASSIGN                                                       !3, 0
          4      > JMP                                                          ->24
    7     5    >   FETCH_DIM_R                                          ~5      !0, !3
          6        TYPE_CHECK                                      128          ~5
          7      > JMPZ                                                         ~6, ->18
    8     8    >   INIT_FCALL_BY_NAME                                           'my_replace_array'
          9        CHECK_FUNC_ARG                                               
         10        FETCH_DIM_FUNC_ARG                                   $8      !0, !3
         11        SEND_FUNC_ARG                                                $8
         12        SEND_VAR_EX                                                  !1
         13        SEND_VAR_EX                                                  !2
         14        DO_FCALL                                          0  $9      
         15        ASSIGN_DIM                                                   !0, !3
         16        OP_DATA                                                      $9
    7    17      > JMP                                                          ->23
   10    18    >   FETCH_DIM_R                                          ~11     !0, !3
         19        FRAMELESS_ICALL_3                str_replace         ~12     !1, !2
         20        OP_DATA                                                      ~11
         21        ASSIGN_DIM                                                   !0, !3
         22        OP_DATA                                                      ~12
    6    23    >   PRE_INC                                                      !3
         24    >   COUNT                                                ~14     !0
         25        IS_SMALLER                                                   !3, ~14
         26      > JMPNZ                                                        ~15, ->5
   13    27    > > RETURN                                                       !0
   14    28*     > RETURN                                                       null

End of function my_replace_array

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
210.98 ms | 4632 KiB | 17 Q