3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCount($str) { $vowelsCount = 0; $vowels = array('a', 'e', 'i', 'o', 'u'); $letters = str_split($str); print_r($letters); foreach ($letters as $letter) { if (in_array($letter, $vowels)) { $vowelsCount++; } } return $vowelsCount; } echo getCount('heyo'); function getMiddle($text) { $length = strlen($text); if ($length%2 == 0) { echo $length/2; return substr($text, $length/2 - 1, 2); } else { return substr($text, $length/2, 1); } } //echo getMiddle('test');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dDcUr
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'getcount'
          1        SEND_VAL                                                 'heyo'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   30     4      > RETURN                                                   1

Function getcount:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/dDcUr
function name:  getCount
number of ops:  22
compiled vars:  !0 = $str, !1 = $vowelsCount, !2 = $vowels, !3 = $letters, !4 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 0
    5     2        ASSIGN                                                   !2, <array>
    6     3        INIT_FCALL                                               'str_split'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !3, $7
    7     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                                 
    8    10      > FE_RESET_R                                       $10     !3, ->19
         11    > > FE_FETCH_R                                               $10, !4, ->19
    9    12    >   INIT_FCALL                                               'in_array'
         13        SEND_VAR                                                 !4
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $11     
         16      > JMPZ                                                     $11, ->18
   10    17    >   PRE_INC                                                  !1
    8    18    > > JMP                                                      ->11
         19    >   FE_FREE                                                  $10
   14    20      > RETURN                                                   !1
   15    21*     > RETURN                                                   null

End of function getcount

Function getmiddle:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dDcUr
function name:  getMiddle
number of ops:  25
compiled vars:  !0 = $text, !1 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        STRLEN                                           ~2      !0
          2        ASSIGN                                                   !1, ~2
   21     3        MOD                                              ~4      !1, 2
          4        IS_EQUAL                                                 ~4, 0
          5      > JMPZ                                                     ~5, ->17
   22     6    >   DIV                                              ~6      !1, 2
          7        ECHO                                                     ~6
   23     8        INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        DIV                                              ~7      !1, 2
         11        SUB                                              ~8      ~7, 1
         12        SEND_VAL                                                 ~8
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $9      
         15      > RETURN                                                   $9
         16*       JMP                                                      ->24
   26    17    >   INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !0
         19        DIV                                              ~10     !1, 2
         20        SEND_VAL                                                 ~10
         21        SEND_VAL                                                 1
         22        DO_ICALL                                         $11     
         23      > RETURN                                                   $11
   28    24*     > RETURN                                                   null

End of function getmiddle

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.54 ms | 1402 KiB | 22 Q