3v4l.org

run code in 300+ PHP versions simultaneously
<?php $alfabeth = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); $comets_by_group = [ 'HALLEY' => 'AMARELO', 'ENCKE' => 'VERMELHO', 'WOLF' => 'PRETO', 'KUSHIDA' => 'AZUL' ]; $sum_position_by_words = function($word) use($alfabeth) { $result = 0; foreach(str_split($word) as $letter) { if(in_array($letter, $alfabeth)) { $value_by_letter = ++array_keys($alfabeth, $letter)[0]; $result *= $value_by_letter; } } return $result; }; $complement = (php_sapi_name() != 'cli') ? "<br>\n" : "\n"; foreach($comets_by_group as $comet => $group) { if($sum_position_by_words($comet) % 45 == $sum_position_by_words($group) % 45){ printf("The group %s of comet %s" . $complement, $comet, $group); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 36
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 36
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 35
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 35
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 36
Branch analysis from position: 17
Branch analysis from position: 36
filename:       /in/shBTe
function name:  (null)
number of ops:  38
compiled vars:  !0 = $alfabeth, !1 = $comets_by_group, !2 = $sum_position_by_words, !3 = $complement, !4 = $group, !5 = $comet
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'str_split'
          1        SEND_VAL                                                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
          2        DO_ICALL                                         $6      
          3        ASSIGN                                                   !0, $6
    4     4        ASSIGN                                                   !1, <array>
   11     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FshBTe%3A11%240'
          6        BIND_LEXICAL                                             ~9, !0
          7        ASSIGN                                                   !2, ~9
   22     8        INIT_FCALL                                               'php_sapi_name'
          9        DO_ICALL                                         $11     
         10        IS_NOT_EQUAL                                             $11, 'cli'
         11      > JMPZ                                                     ~12, ->14
         12    >   QM_ASSIGN                                        ~13     '%3Cbr%3E%0A'
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~13     '%0A'
         15    >   ASSIGN                                                   !3, ~13
   24    16      > FE_RESET_R                                       $15     !1, ->36
         17    > > FE_FETCH_R                                       ~16     $15, !4, ->36
         18    >   ASSIGN                                                   !5, ~16
   25    19        INIT_DYNAMIC_CALL                                        !2
         20        SEND_VAR_EX                                              !5
         21        DO_FCALL                                      0  $18     
         22        MOD                                              ~19     $18, 45
         23        INIT_DYNAMIC_CALL                                        !2
         24        SEND_VAR_EX                                              !4
         25        DO_FCALL                                      0  $20     
         26        MOD                                              ~21     $20, 45
         27        IS_EQUAL                                                 ~19, ~21
         28      > JMPZ                                                     ~22, ->35
   26    29    >   INIT_FCALL                                               'printf'
         30        CONCAT                                           ~23     'The+group+%25s+of+comet+%25s', !3
         31        SEND_VAL                                                 ~23
         32        SEND_VAR                                                 !5
         33        SEND_VAR                                                 !4
         34        DO_ICALL                                                 
   24    35    > > JMP                                                      ->17
         36    >   FE_FREE                                                  $15
   28    37      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FshBTe%3A11%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 23
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/shBTe
function name:  {closure}
number of ops:  26
compiled vars:  !0 = $word, !1 = $alfabeth, !2 = $result, !3 = $letter, !4 = $value_by_letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        ASSIGN                                                   !2, 0
   13     3        INIT_FCALL                                               'str_split'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6      > FE_RESET_R                                       $7      $6, ->23
          7    > > FE_FETCH_R                                               $7, !3, ->23
   14     8    >   INIT_FCALL                                               'in_array'
          9        SEND_VAR                                                 !3
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $8      
         12      > JMPZ                                                     $8, ->22
   15    13    >   INIT_FCALL                                               'array_keys'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $9      
         17        SEPARATE                                         $9      $9
         18        FETCH_DIM_RW                                     $10     $9, 0
         19        PRE_INC                                          ~11     $10
         20        ASSIGN                                                   !4, ~11
   16    21        ASSIGN_OP                                     3          !2, !4
   13    22    > > JMP                                                      ->7
         23    >   FE_FREE                                                  $7
   19    24      > RETURN                                                   !2
   20    25*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FshBTe%3A11%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.56 ms | 1400 KiB | 23 Q