3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Card { private $suit; private $val; public function __construct($val, $suit) { $values = array( 'J' => 11, 'Q' => 12, 'K' => 13, 'A' => 14, ); $suits = array( 'H' => 'Hearts', 'C' => 'Clubs', 'D' => 'Diamonds', 'S' => 'Spades' ); $this->suit = $suits[$suit]; $this->val = $values[$val] ?? $val; } public function getSuit() { return $this->suit; } public function getVal() { return $this->val; } public function setVal($val) { $this->val = $val; } } class Hand { private $cards; private $matches = array(); private $values = array(); private $flush; private $rank; public function __construct($hand) { $cards = explode(' ', $hand); foreach ($cards as $card) { $val = substr($card, 0, -1); $suit = strtoupper(substr($card, -1)); $this->cards[] = new Card($val, $suit); } // get values of cards in hand $this->values = array_map(function ($card) { return $card->getVal(); }, $this->cards); // get suits of cards in hand $this->suits = array_map(function ($card) { return $card->getSuit(); }, $this->cards); // get pairs of threes and fours $this->pairs = $this->threes = $this->fours = []; // might be a straight $this->possibleStraight = true; $this->hands = array_count_values($this->values); // if there are more than 2 same card values, it can't be a straight if (max($this->hands) > 1) { $this->possibleStraight = false; } // match for pairs foreach ($this->hands as $face => $count) { // one or two pairs if ($count === 2) { $this->pairs[] = $face; } // three of a kind if ($count === 3) { $this->threes[] = $face; } // four of a kind if ($count === 4) { $this->fours[] = $face; } } } public function evalHand() { $this->getHighCard(); $this->isOnePair(); $this->isTwoPair(); $this->getThrees(); $this->getFours(); $this->isFullHouse(); $this->isFlush(); $this->isStraight(); $this->isStraightFlush(); $this->isRoyalFlush(); } public function getRank() { echo $this->rank; } public function getCards() { return $this->cards; } public function getValues() { return $this->values; } public function getSuits() { return $this->suits; } public function getHighCard() { return max($this->getValues()); } public function getPairs() { return $this->pairs; } public function isOnePair() { if (count($this->pairs) == 1) { $this->rank = 'One Pair'; } return (count($this->pairs) == 1 ? true : false); } public function isTwoPair() { if (count($this->pairs) == 2) { $this->rank = 'Two Pair'; } return (count($this->pairs) == 2 ? true : false); } public function getThrees() { $this->rank = 'Three of a Kind'; return $this->threes; } public function getFours() { $this->rank = 'Four of a Kind'; return $this->fours; } public function hasAce() { return isset($this->hands['14']); } public function isFullHouse() { if (count($this->pairs) == 1 && count($this->threes) == 1) { $this->rank = 'Flush'; } return count($this->pairs) == 1 && count($this->threes) == 1; } public function isFlush() { $suits = array_count_values($this->getSuits()); // match flush foreach ($suits as $face => $count) { if ($count == 5) { $this->flush = true; $this->rank = 'Flush'; } else { $this->flush = false; } } return $this->flush; } public function isStraightAce() { $cards = $this->getValues(); if (array_search(14, $cards) !== FALSE && array_search(2, $cards) !== FALSE && array_search(3, $cards) !== FALSE && array_search(4, $cards) !== FALSE && array_search(5, $cards) !== FALSE) { $this->straight = true; } else { $this->straight = false; } return $this->straight; } public function isStraightRegular() { $cards = $this->getValues(); if (max($cards) - min($cards) == 4) { $this->straight = true; } else { $this->straight = false; } return $this->straight; } public function isStraight() { if ($this->isStraightAce()) { $this->straight = true; $this->rank = 'Straight'; } else if ($this->isStraightRegular()) { $this->straight = true; $this->rank = 'Straight'; } else { $this->straight = false; } return $this->straight; } public function isStraightFlush() { if ($this->isFlush() && $this->isStraight()) { $this->rank = 'Straight Flush'; }; return ($this->isFlush() && $this->isStraight()); } public function isRoyal() { $cards = $this->getValues(); if (array_search(10, $cards) !== FALSE && array_search(11, $cards) !== FALSE && array_search(12, $cards) !== FALSE && array_search(13, $cards) !== FALSE && array_search(14, $cards) !== FALSE) { return true; } else { return false; } } public function isRoyalFlush() { if ($this->isFlush() && $this->isRoyal()) { $this->rank = 'Royal Flush'; }; return ($this->isFlush() && $this->isRoyal()); } } echo "First Card: 2s 3h 4h 5h As\n\n"; $h = new Hand('2s 3h 4h 5h As'); $h->evalHand(); $h->getRank(); echo "\n\nSecond Card: 2s 3h 4h 5h 6s\n\n"; $h = new Hand('2s 3h 4h 5h 6s'); $h->evalHand(); $h->getRank(); echo "\n\nThird Card: 2h 3h 4h 5h 6h\n\n"; $h = new Hand('2h 3h 4h 5h 6h'); $h->evalHand(); $h->getRank(); echo "\n\nFourth Card: As Ks Qs Js 10s\n\n"; $h = new Hand('As Ks Qs Js 10s'); $h->evalHand(); $h->getRank();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  (null)
number of ops:  37
compiled vars:  !0 = $h
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  264     0  E >   ECHO                                                     'First+Card%3A+2s+3h+4h+5h+As%0A%0A'
  265     1        NEW                                              $1      'Hand'
          2        SEND_VAL_EX                                              '2s+3h+4h+5h+As'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
  266     5        INIT_METHOD_CALL                                         !0, 'evalHand'
          6        DO_FCALL                                      0          
  267     7        INIT_METHOD_CALL                                         !0, 'getRank'
          8        DO_FCALL                                      0          
  269     9        ECHO                                                     '%0A%0ASecond+Card%3A+2s+3h+4h+5h+6s%0A%0A'
  270    10        NEW                                              $6      'Hand'
         11        SEND_VAL_EX                                              '2s+3h+4h+5h+6s'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $6
  271    14        INIT_METHOD_CALL                                         !0, 'evalHand'
         15        DO_FCALL                                      0          
  272    16        INIT_METHOD_CALL                                         !0, 'getRank'
         17        DO_FCALL                                      0          
  274    18        ECHO                                                     '%0A%0AThird+Card%3A+2h+3h+4h+5h+6h%0A%0A'
  275    19        NEW                                              $11     'Hand'
         20        SEND_VAL_EX                                              '2h+3h+4h+5h+6h'
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !0, $11
  276    23        INIT_METHOD_CALL                                         !0, 'evalHand'
         24        DO_FCALL                                      0          
  277    25        INIT_METHOD_CALL                                         !0, 'getRank'
         26        DO_FCALL                                      0          
  279    27        ECHO                                                     '%0A%0AFourth+Card%3A+As+Ks+Qs+Js+10s%0A%0A'
  280    28        NEW                                              $16     'Hand'
         29        SEND_VAL_EX                                              'As+Ks+Qs+Js+10s'
         30        DO_FCALL                                      0          
         31        ASSIGN                                                   !0, $16
  281    32        INIT_METHOD_CALL                                         !0, 'evalHand'
         33        DO_FCALL                                      0          
  282    34        INIT_METHOD_CALL                                         !0, 'getRank'
         35        DO_FCALL                                      0          
         36      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FaE1M7%3A60%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $card
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   RECV                                             !0      
   61     1        INIT_METHOD_CALL                                         !0, 'getVal'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   62     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FaE1M7%3A60%240

Function %00%7Bclosure%7D%2Fin%2FaE1M7%3A65%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $card
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   RECV                                             !0      
   66     1        INIT_METHOD_CALL                                         !0, 'getSuit'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   67     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FaE1M7%3A65%241

Class Card:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  __construct
number of ops:  13
compiled vars:  !0 = $val, !1 = $suit, !2 = $values, !3 = $suits
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ASSIGN                                                   !2, <array>
   16     3        ASSIGN                                                   !3, <array>
   23     4        FETCH_DIM_R                                      ~7      !3, !1
          5        ASSIGN_OBJ                                               'suit'
          6        OP_DATA                                                  ~7
   24     7        FETCH_DIM_IS                                     ~9      !2, !0
          8        COALESCE                                         ~10     ~9
          9        QM_ASSIGN                                        ~10     !0
         10        ASSIGN_OBJ                                               'val'
         11        OP_DATA                                                  ~10
   25    12      > RETURN                                                   null

End of function __construct

Function getsuit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getSuit
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   FETCH_OBJ_R                                      ~0      'suit'
          1      > RETURN                                                   ~0
   29     2*     > RETURN                                                   null

End of function getsuit

Function getval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getVal
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   FETCH_OBJ_R                                      ~0      'val'
          1      > RETURN                                                   ~0
   33     2*     > RETURN                                                   null

End of function getval

Function setval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  setVal
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   36     1        ASSIGN_OBJ                                               'val'
          2        OP_DATA                                                  !0
   37     3      > RETURN                                                   null

End of function setval

End of class Card.

Class Hand:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 30
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 30
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 69
Branch analysis from position: 67
2 jumps found. (Code = 77) Position 1 = 71, Position 2 = 89
Branch analysis from position: 71
2 jumps found. (Code = 78) Position 1 = 72, Position 2 = 89
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 78
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 83
Branch analysis from position: 80
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 88
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 88
Branch analysis from position: 83
Branch analysis from position: 78
Branch analysis from position: 89
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 89
Branch analysis from position: 69
Branch analysis from position: 30
filename:       /in/aE1M7
function name:  __construct
number of ops:  91
compiled vars:  !0 = $hand, !1 = $cards, !2 = $card, !3 = $val, !4 = $suit, !5 = $count, !6 = $face
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
   51     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
   53     6      > FE_RESET_R                                       $9      !1, ->30
          7    > > FE_FETCH_R                                               $9, !2, ->30
   54     8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !2
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 -1
         12        DO_ICALL                                         $10     
         13        ASSIGN                                                   !3, $10
   55    14        INIT_FCALL                                               'strtoupper'
         15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !2
         17        SEND_VAL                                                 -1
         18        DO_ICALL                                         $12     
         19        SEND_VAR                                                 $12
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !4, $13
   56    22        NEW                                              $17     'Card'
         23        SEND_VAR_EX                                              !3
         24        SEND_VAR_EX                                              !4
         25        DO_FCALL                                      0          
         26        FETCH_OBJ_W                                      $15     'cards'
         27        ASSIGN_DIM                                               $15
         28        OP_DATA                                                  $17
   53    29      > JMP                                                      ->7
         30    >   FE_FREE                                                  $9
   60    31        INIT_FCALL                                               'array_map'
         32        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FaE1M7%3A60%240'
   62    33        SEND_VAL                                                 ~20
         34        FETCH_OBJ_R                                      ~21     'cards'
         35        SEND_VAL                                                 ~21
         36        DO_ICALL                                         $22     
   60    37        ASSIGN_OBJ                                               'values'
   62    38        OP_DATA                                                  $22
   65    39        INIT_FCALL                                               'array_map'
         40        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FaE1M7%3A65%241'
   67    41        SEND_VAL                                                 ~24
         42        FETCH_OBJ_R                                      ~25     'cards'
         43        SEND_VAL                                                 ~25
         44        DO_ICALL                                         $26     
   65    45        ASSIGN_OBJ                                               'suits'
   67    46        OP_DATA                                                  $26
   70    47        ASSIGN_OBJ                                       ~29     'fours'
         48        OP_DATA                                                  <array>
         49        ASSIGN_OBJ                                       ~28     'threes'
         50        OP_DATA                                                  ~29
         51        ASSIGN_OBJ                                               'pairs'
         52        OP_DATA                                                  ~28
   73    53        ASSIGN_OBJ                                               'possibleStraight'
         54        OP_DATA                                                  <true>
   75    55        INIT_FCALL                                               'array_count_values'
         56        FETCH_OBJ_R                                      ~32     'values'
         57        SEND_VAL                                                 ~32
         58        DO_ICALL                                         $33     
         59        ASSIGN_OBJ                                               'hands'
         60        OP_DATA                                                  $33
   78    61        INIT_FCALL                                               'max'
         62        FETCH_OBJ_R                                      ~34     'hands'
         63        SEND_VAL                                                 ~34
         64        DO_ICALL                                         $35     
         65        IS_SMALLER                                               1, $35
         66      > JMPZ                                                     ~36, ->69
   79    67    >   ASSIGN_OBJ                                               'possibleStraight'
         68        OP_DATA                                                  <false>
   83    69    >   FETCH_OBJ_R                                      ~38     'hands'
         70      > FE_RESET_R                                       $39     ~38, ->89
         71    > > FE_FETCH_R                                       ~40     $39, !5, ->89
         72    >   ASSIGN                                                   !6, ~40
   85    73        IS_IDENTICAL                                             !5, 2
         74      > JMPZ                                                     ~42, ->78
   86    75    >   FETCH_OBJ_W                                      $43     'pairs'
         76        ASSIGN_DIM                                               $43
         77        OP_DATA                                                  !6
   90    78    >   IS_IDENTICAL                                             !5, 3
         79      > JMPZ                                                     ~45, ->83
   91    80    >   FETCH_OBJ_W                                      $46     'threes'
         81        ASSIGN_DIM                                               $46
         82        OP_DATA                                                  !6
   95    83    >   IS_IDENTICAL                                             !5, 4
         84      > JMPZ                                                     ~48, ->88
   96    85    >   FETCH_OBJ_W                                      $49     'fours'
         86        ASSIGN_DIM                                               $49
         87        OP_DATA                                                  !6
   83    88    > > JMP                                                      ->71
         89    >   FE_FREE                                                  $39
   99    90      > RETURN                                                   null

End of function __construct

Function evalhand:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  evalHand
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  102     0  E >   INIT_METHOD_CALL                                         'getHighCard'
          1        DO_FCALL                                      0          
  103     2        INIT_METHOD_CALL                                         'isOnePair'
          3        DO_FCALL                                      0          
  104     4        INIT_METHOD_CALL                                         'isTwoPair'
          5        DO_FCALL                                      0          
  105     6        INIT_METHOD_CALL                                         'getThrees'
          7        DO_FCALL                                      0          
  106     8        INIT_METHOD_CALL                                         'getFours'
          9        DO_FCALL                                      0          
  107    10        INIT_METHOD_CALL                                         'isFullHouse'
         11        DO_FCALL                                      0          
  108    12        INIT_METHOD_CALL                                         'isFlush'
         13        DO_FCALL                                      0          
  109    14        INIT_METHOD_CALL                                         'isStraight'
         15        DO_FCALL                                      0          
  110    16        INIT_METHOD_CALL                                         'isStraightFlush'
         17        DO_FCALL                                      0          
  111    18        INIT_METHOD_CALL                                         'isRoyalFlush'
         19        DO_FCALL                                      0          
  112    20      > RETURN                                                   null

End of function evalhand

Function getrank:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getRank
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  115     0  E >   FETCH_OBJ_R                                      ~0      'rank'
          1        ECHO                                                     ~0
  116     2      > RETURN                                                   null

End of function getrank

Function getcards:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getCards
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  119     0  E >   FETCH_OBJ_R                                      ~0      'cards'
          1      > RETURN                                                   ~0
  120     2*     > RETURN                                                   null

End of function getcards

Function getvalues:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getValues
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  123     0  E >   FETCH_OBJ_R                                      ~0      'values'
          1      > RETURN                                                   ~0
  124     2*     > RETURN                                                   null

End of function getvalues

Function getsuits:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getSuits
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  127     0  E >   FETCH_OBJ_R                                      ~0      'suits'
          1      > RETURN                                                   ~0
  128     2*     > RETURN                                                   null

End of function getsuits

Function gethighcard:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getHighCard
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  131     0  E >   INIT_FCALL                                               'max'
          1        INIT_METHOD_CALL                                         'getValues'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
  132     6*     > RETURN                                                   null

End of function gethighcard

Function getpairs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getPairs
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  135     0  E >   FETCH_OBJ_R                                      ~0      'pairs'
          1      > RETURN                                                   ~0
  136     2*     > RETURN                                                   null

End of function getpairs

Function isonepair:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/aE1M7
function name:  isOnePair
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  139     0  E >   FETCH_OBJ_R                                      ~0      'pairs'
          1        COUNT                                            ~1      ~0
          2        IS_EQUAL                                                 ~1, 1
          3      > JMPZ                                                     ~2, ->6
  140     4    >   ASSIGN_OBJ                                               'rank'
          5        OP_DATA                                                  'One+Pair'
  142     6    >   FETCH_OBJ_R                                      ~4      'pairs'
          7        COUNT                                            ~5      ~4
          8        IS_EQUAL                                                 ~5, 1
          9      > JMPZ                                                     ~6, ->12
         10    >   QM_ASSIGN                                        ~7      <true>
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~7      <false>
         13    > > RETURN                                                   ~7
  143    14*     > RETURN                                                   null

End of function isonepair

Function istwopair:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/aE1M7
function name:  isTwoPair
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  146     0  E >   FETCH_OBJ_R                                      ~0      'pairs'
          1        COUNT                                            ~1      ~0
          2        IS_EQUAL                                                 ~1, 2
          3      > JMPZ                                                     ~2, ->6
  147     4    >   ASSIGN_OBJ                                               'rank'
          5        OP_DATA                                                  'Two+Pair'
  149     6    >   FETCH_OBJ_R                                      ~4      'pairs'
          7        COUNT                                            ~5      ~4
          8        IS_EQUAL                                                 ~5, 2
          9      > JMPZ                                                     ~6, ->12
         10    >   QM_ASSIGN                                        ~7      <true>
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~7      <false>
         13    > > RETURN                                                   ~7
  150    14*     > RETURN                                                   null

End of function istwopair

Function getthrees:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getThrees
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  153     0  E >   ASSIGN_OBJ                                               'rank'
          1        OP_DATA                                                  'Three+of+a+Kind'
  154     2        FETCH_OBJ_R                                      ~1      'threes'
          3      > RETURN                                                   ~1
  155     4*     > RETURN                                                   null

End of function getthrees

Function getfours:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  getFours
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  158     0  E >   ASSIGN_OBJ                                               'rank'
          1        OP_DATA                                                  'Four+of+a+Kind'
  159     2        FETCH_OBJ_R                                      ~1      'fours'
          3      > RETURN                                                   ~1
  160     4*     > RETURN                                                   null

End of function getfours

Function hasace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aE1M7
function name:  hasAce
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  163     0  E >   FETCH_OBJ_IS                                     ~0      'hands'
          1        ISSET_ISEMPTY_DIM_OBJ                         0  ~1      ~0, 14
          2      > RETURN                                                   ~1
  164     3*     > RETURN                                                   null

End of function hasace

Function isfullhouse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 11
Branch analysis from position: 8
filename:       /in/aE1M7
function name:  isFullHouse
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  167     0  E >   FETCH_OBJ_R                                      ~0      'pairs'
          1        COUNT                                            ~1      ~0
          2        IS_EQUAL                                         ~2      ~1, 1
          3      > JMPZ_EX                                          ~2      ~2, ->8
          4    >   FETCH_OBJ_R                                      ~3      'threes'
          5        COUNT                                            ~4      ~3
          6        IS_EQUAL                                         ~5      ~4, 1
          7        BOOL                                             ~2      ~5
          8    > > JMPZ                                                     ~2, ->11
  168     9    >   ASSIGN_OBJ                                               'rank'
         10        OP_DATA                                                  'Flush'
  170    11    >   FETCH_OBJ_R                                      ~7      'pairs'
         12        COUNT                                            ~8      ~7
         13        IS_EQUAL                                         ~9      ~8, 1
         14      > JMPZ_EX                       

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.87 ms | 1420 KiB | 25 Q