3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Our recursive function. function recursive($str, $count, $start, &$duplicate){ //Print out the number. if($count > $start) { if(!isset($duplicate[$str[$start]])) { $duplicate[$str[$start]] = 1; return recursive($str, $count, $start+1, $duplicate); } else { //array_push($duplicate, array($start=>$str[$start])); $duplicate[$str[$start]] +=1; return recursive($str, $count, $start+1, $duplicate); } } } //Set our start number to 1. $str = 'buffet'; $count = strlen($str); $start = 0; $duplicate = array(); //Call our recursive function. recursive($str, $count, $start, $duplicate); print_r($duplicate);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pSaid
function name:  (null)
number of ops:  15
compiled vars:  !0 = $str, !1 = $count, !2 = $start, !3 = $duplicate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 'buffet'
   22     1        STRLEN                                           ~5      !0
          2        ASSIGN                                                   !1, ~5
   23     3        ASSIGN                                                   !2, 0
   24     4        ASSIGN                                                   !3, <array>
   26     5        INIT_FCALL                                               'recursive'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !2
          9        SEND_REF                                                 !3
         10        DO_FCALL                                      0          
   27    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function recursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 33
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pSaid
function name:  recursive
number of ops:  34
compiled vars:  !0 = $str, !1 = $count, !2 = $start, !3 = $duplicate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    8     4        IS_SMALLER                                               !2, !1
          5      > JMPZ                                                     ~4, ->33
    9     6    >   FETCH_DIM_R                                      ~5      !0, !2
          7        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !3, ~5
          8        BOOL_NOT                                         ~7      ~6
          9      > JMPZ                                                     ~7, ->22
   10    10    >   FETCH_DIM_R                                      ~8      !0, !2
         11        ASSIGN_DIM                                               !3, ~8
         12        OP_DATA                                                  1
   11    13        INIT_FCALL_BY_NAME                                       'recursive'
         14        SEND_VAR_EX                                              !0
         15        SEND_VAR_EX                                              !1
         16        ADD                                              ~10     !2, 1
         17        SEND_VAL_EX                                              ~10
         18        SEND_VAR_EX                                              !3
         19        DO_FCALL                                      0  $11     
         20      > RETURN                                                   $11
    9    21*       JMP                                                      ->33
   14    22    >   FETCH_DIM_R                                      ~12     !0, !2
         23        ASSIGN_DIM_OP                +=               1          !3, ~12
         24        OP_DATA                                                  1
   15    25        INIT_FCALL_BY_NAME                                       'recursive'
         26        SEND_VAR_EX                                              !0
         27        SEND_VAR_EX                                              !1
         28        ADD                                              ~14     !2, 1
         29        SEND_VAL_EX                                              ~14
         30        SEND_VAR_EX                                              !3
         31        DO_FCALL                                      0  $15     
         32      > RETURN                                                   $15
   18    33    > > RETURN                                                   null

End of function recursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
265.61 ms | 1009 KiB | 15 Q