3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Declare the suits $suits = array ( "Spades", "Hearts", "Clubs", "Diamonds" ); // Declare the faces $faces = array ( "Two"=>2, "Three"=>3, "Four"=>4, "Five"=>5, "Six"=>6, "Seven"=>7, "Eight"=>8, "Nine"=>9, "Ten"=>10, "Jack"=>10, "Queen"=>10, "King"=>10, "Ace"=>11 ); // create deck array // get all suits which has foreach($suits as $suit) { // get all the keys frok faces // now $keys = array_key($faces); // loop through the keys as faces foreach ($keys as $face) { // declare the deck array $deck = ['face' => $face, 'suit' => $suit]; var_dump($deck); } foreach($faces as $face => $value) { $deck = ['face' => $face, 'suit' => $suit ]; } var_dump($deck); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 30
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 25
Branch analysis from position: 17
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/SmM55
function name:  (null)
number of ops:  32
compiled vars:  !0 = $suits, !1 = $faces, !2 = $suit, !3 = $keys, !4 = $face, !5 = $deck, !6 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   21     2      > FE_RESET_R                                       $9      !0, ->30
          3    > > FE_FETCH_R                                               $9, !2, ->30
   25     4    >   INIT_FCALL_BY_NAME                                       'array_key'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $10     
          7        ASSIGN                                                   !3, $10
   27     8      > FE_RESET_R                                       $12     !3, ->17
          9    > > FE_FETCH_R                                               $12, !4, ->17
   30    10    >   INIT_ARRAY                                       ~13     !4, 'face'
         11        ADD_ARRAY_ELEMENT                                ~13     !2, 'suit'
         12        ASSIGN                                                   !5, ~13
   31    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !5
         15        DO_ICALL                                                 
   27    16      > JMP                                                      ->9
         17    >   FE_FREE                                                  $12
   34    18      > FE_RESET_R                                       $16     !1, ->25
         19    > > FE_FETCH_R                                       ~17     $16, !6, ->25
         20    >   ASSIGN                                                   !4, ~17
   35    21        INIT_ARRAY                                       ~19     !4, 'face'
         22        ADD_ARRAY_ELEMENT                                ~19     !2, 'suit'
         23        ASSIGN                                                   !5, ~19
   34    24      > JMP                                                      ->19
         25    >   FE_FREE                                                  $16
   38    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !5
         28        DO_ICALL                                                 
   21    29      > JMP                                                      ->3
         30    >   FE_FREE                                                  $9
   40    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.42 ms | 1400 KiB | 15 Q