3v4l.org

run code in 300+ PHP versions simultaneously
<?php $maxMatches = 3; $matches = array('tails' => 0, 'heads' => 0, 'total' => 0); while(max($matches['tails'], $matches['heads']) < $maxMatches) { $faceType = rand(0, 1); if ($faceType) { $matches['heads']++; $matches['tails'] = 0; echo $faceType . " is heads\n"; } else { $matches['tails']++; $matches['heads'] = 0; echo $faceType." is tails\n"; } $matches['total']++; } echo "total flips took is: " . $matches['total'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 3
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 3
Branch analysis from position: 32
Branch analysis from position: 3
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 3
Branch analysis from position: 32
Branch analysis from position: 3
filename:       /in/IsbBY
function name:  (null)
number of ops:  36
compiled vars:  !0 = $maxMatches, !1 = $matches, !2 = $faceType
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 3
    4     1        ASSIGN                                                   !1, <array>
    6     2      > JMP                                                      ->24
    7     3    >   INIT_FCALL                                               'rand'
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
    8     8      > JMPZ                                                     !2, ->16
    9     9    >   FETCH_DIM_RW                                     $7      !1, 'heads'
         10        PRE_INC                                                  $7
   10    11        ASSIGN_DIM                                               !1, 'tails'
         12        OP_DATA                                                  0
   11    13        CONCAT                                           ~10     !2, '+is+heads%0A'
         14        ECHO                                                     ~10
         15      > JMP                                                      ->22
   14    16    >   FETCH_DIM_RW                                     $11     !1, 'tails'
         17        PRE_INC                                                  $11
   15    18        ASSIGN_DIM                                               !1, 'heads'
         19        OP_DATA                                                  0
   16    20        CONCAT                                           ~14     !2, '+is+tails%0A'
         21        ECHO                                                     ~14
   18    22    >   FETCH_DIM_RW                                     $15     !1, 'total'
         23        PRE_INC                                                  $15
    6    24    >   INIT_FCALL                                               'max'
         25        FETCH_DIM_R                                      ~17     !1, 'tails'
         26        SEND_VAL                                                 ~17
         27        FETCH_DIM_R                                      ~18     !1, 'heads'
         28        SEND_VAL                                                 ~18
         29        DO_ICALL                                         $19     
         30        IS_SMALLER                                               $19, !0
         31      > JMPNZ                                                    ~20, ->3
   21    32    >   FETCH_DIM_R                                      ~21     !1, 'total'
         33        CONCAT                                           ~22     'total+flips+took+is%3A+', ~21
         34        ECHO                                                     ~22
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.92 ms | 1400 KiB | 17 Q