3v4l.org

run code in 500+ PHP versions simultaneously
<?php function fizzBuzz($number,array $array) { if (array_key_exists($number, $array)) { $number = $array[$number]; return strval($number); } else { foreach($array as $key => $value) { $div = $number/$key; if(array_key_exists(intval($div),$array)) { if ($key < $div) { return $array[$key] . "" . $array[$div]; } else { return $array[$div] . "" . $array[$key]; } } return $array[$key]; } } } # code test : $map = array(3 => "FIZZ", 4 => "BUZZ"); echo fizzBuzz(5,$map) . "\n"; // "5" echo fizzBuzz(3,$map) . "\n"; // "FIZZ" echo fizzBuzz(4,$map) . "\n"; // "BUZZ" echo fizzBuzz(12,$map) . "\n"; // "FIZZBUZZ"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eHjrv
function name:  (null)
number of ops:  26
compiled vars:  !0 = $map
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   ASSIGN                                                       !0, <array>
   27     1        INIT_FCALL                                                   'fizzbuzz'
          2        SEND_VAL                                                     5
          3        SEND_VAR                                                     !0
          4        DO_FCALL                                          0  $2      
          5        CONCAT                                               ~3      $2, '%0A'
          6        ECHO                                                         ~3
   28     7        INIT_FCALL                                                   'fizzbuzz'
          8        SEND_VAL                                                     3
          9        SEND_VAR                                                     !0
         10        DO_FCALL                                          0  $4      
         11        CONCAT                                               ~5      $4, '%0A'
         12        ECHO                                                         ~5
   29    13        INIT_FCALL                                                   'fizzbuzz'
         14        SEND_VAL                                                     4
         15        SEND_VAR                                                     !0
         16        DO_FCALL                                          0  $6      
         17        CONCAT                                               ~7      $6, '%0A'
         18        ECHO                                                         ~7
   30    19        INIT_FCALL                                                   'fizzbuzz'
         20        SEND_VAL                                                     12
         21        SEND_VAR                                                     !0
         22        DO_FCALL                                          0  $8      
         23        CONCAT                                               ~9      $8, '%0A'
         24        ECHO                                                         ~9
         25      > RETURN                                                       1

Function fizzbuzz:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 36
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 36
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 32
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/eHjrv
function name:  fizzBuzz
number of ops:  38
compiled vars:  !0 = $number, !1 = $array, !2 = $value, !3 = $key, !4 = $div
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        ARRAY_KEY_EXISTS                                             !0, !1
          3      > JMPZ                                                         ~5, ->9
    6     4    >   FETCH_DIM_R                                          ~6      !1, !0
          5        ASSIGN                                                       !0, ~6
    7     6        CAST                                              6  ~8      !0
          7      > RETURN                                                       ~8
    5     8*       JMP                                                          ->37
    9     9    > > FE_RESET_R                                           $9      !1, ->36
         10    > > FE_FETCH_R                                           ~10     $9, !2, ->36
         11    >   ASSIGN                                                       !3, ~10
   10    12        DIV                                                  ~12     !0, !3
         13        ASSIGN                                                       !4, ~12
   11    14        CAST                                              4  ~14     !4
         15        ARRAY_KEY_EXISTS                                             ~14, !1
         16      > JMPZ                                                         ~15, ->32
   12    17    >   IS_SMALLER                                                   !3, !4
         18      > JMPZ                                                         ~16, ->26
   13    19    >   FETCH_DIM_R                                          ~17     !1, !3
         20        CONCAT                                               ~18     ~17, ''
         21        FETCH_DIM_R                                          ~19     !1, !4
         22        CONCAT                                               ~20     ~18, ~19
         23        FE_FREE                                                      $9
         24      > RETURN                                                       ~20
   12    25*       JMP                                                          ->32
   15    26    >   FETCH_DIM_R                                          ~21     !1, !4
         27        CONCAT                                               ~22     ~21, ''
         28        FETCH_DIM_R                                          ~23     !1, !3
         29        CONCAT                                               ~24     ~22, ~23
         30        FE_FREE                                                      $9
         31      > RETURN                                                       ~24
   18    32    >   FETCH_DIM_R                                          ~25     !1, !3
         33        FE_FREE                                                      $9
         34      > RETURN                                                       ~25
    9    35*       JMP                                                          ->10
         36    >   FE_FREE                                                      $9
   21    37      > RETURN                                                       null

End of function fizzbuzz

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.96 ms | 2141 KiB | 17 Q