3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Ham followed now ecstatic use speaking exercise may repeated. Himself he evident oh greatly my on inhabit general concern. It allowance prevailed enjoyment in it. Calling observe for who pressed raising his. Can connection instrument astonished unaffected his motionless preference. Announcing say boy precaution unaffected difficulty alteration him."; function countt($text, $word, $count = 0) { $found = ''; for ($i = 0; $i < strlen($word); $i++) { for ($j = 0; $j < strlen($text); $j++) { if ($word[$i] === $text[$j]) { $text = substr($text, 0, $j) . substr($text, $j + 1); $found .= $word[$i]; if ($found === $word) { $count++; return countt($text, $word, $count); } break; } } } return $count; } echo countt($text, 'potato');//6
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h43rq
function name:  (null)
number of ops:  7
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Ham+followed+now+ecstatic+use+speaking+exercise+may+repeated.%0AHimself+he+evident+oh+greatly+my+on+inhabit+general+concern.+It+allowance+%0Aprevailed+enjoyment+in+it.+Calling+observe+for+who+pressed+raising+his.+Can+%0Aconnection+instrument+astonished+unaffected+his+motionless+preference.+%0AAnnouncing+say+boy+precaution+unaffected+difficulty+alteration+him.'
   27     1        INIT_FCALL                                               'countt'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'potato'
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function countt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 6
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 8
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 6
Branch analysis from position: 44
Branch analysis from position: 6
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 36
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 35
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 8
Branch analysis from position: 40
Branch analysis from position: 8
filename:       /in/h43rq
function name:  countt
number of ops:  46
compiled vars:  !0 = $text, !1 = $word, !2 = $count, !3 = $found, !4 = $i, !5 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      0
   10     3        ASSIGN                                                   !3, ''
   11     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->41
   12     6    >   ASSIGN                                                   !5, 0
          7      > JMP                                                      ->37
   13     8    >   FETCH_DIM_R                                      ~9      !1, !4
          9        FETCH_DIM_R                                      ~10     !0, !5
         10        IS_IDENTICAL                                             ~9, ~10
         11      > JMPZ                                                     ~11, ->36
   14    12    >   INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 0
         15        SEND_VAR                                                 !5
         16        DO_ICALL                                         $12     
         17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !0
         19        ADD                                              ~13     !5, 1
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                         $14     
         22        CONCAT                                           ~15     $12, $14
         23        ASSIGN                                                   !0, ~15
   15    24        FETCH_DIM_R                                      ~17     !1, !4
         25        ASSIGN_OP                                     8          !3, ~17
   16    26        IS_IDENTICAL                                             !3, !1
         27      > JMPZ                                                     ~19, ->35
   17    28    >   PRE_INC                                                  !2
   18    29        INIT_FCALL_BY_NAME                                       'countt'
         30        SEND_VAR_EX                                              !0
         31        SEND_VAR_EX                                              !1
         32        SEND_VAR_EX                                              !2
         33        DO_FCALL                                      0  $21     
         34      > RETURN                                                   $21
   20    35    > > JMP                                                      ->40
   12    36    >   PRE_INC                                                  !5
         37    >   STRLEN                                           ~23     !0
         38        IS_SMALLER                                               !5, ~23
         39      > JMPNZ                                                    ~24, ->8
   11    40    >   PRE_INC                                                  !4
         41    >   STRLEN                                           ~26     !1
         42        IS_SMALLER                                               !4, ~26
         43      > JMPNZ                                                    ~27, ->6
   24    44    > > RETURN                                                   !2
   25    45*     > RETURN                                                   null

End of function countt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.51 ms | 1007 KiB | 15 Q