3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cointoss () { return mt_rand(0,1); } $previous_toss = null; $toss = null; do { if ($toss !== null) { $previous_toss = $toss; } $toss = cointoss(); echo ($toss ? '<img src="heads.jpg"/>' : '<img src="tails.jpg"/>') , "\n"; } while ($previous_toss + $toss != 2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 2
Branch analysis from position: 17
Branch analysis from position: 2
Branch analysis from position: 5
filename:       /in/aERZ5
function name:  (null)
number of ops:  18
compiled vars:  !0 = $previous_toss, !1 = $toss
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, null
    8     1        ASSIGN                                                   !1, null
   10     2    >   TYPE_CHECK                                  1020          !1
          3      > JMPZ                                                     ~4, ->5
   11     4    >   ASSIGN                                                   !0, !1
   13     5    >   INIT_FCALL                                               'cointoss'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
   14     8      > JMPZ                                                     !1, ->11
          9    >   QM_ASSIGN                                        ~8      '%3Cimg+src%3D%22heads.jpg%22%2F%3E'
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~8      '%3Cimg+src%3D%22tails.jpg%22%2F%3E'
         12    >   ECHO                                                     ~8
         13        ECHO                                                     '%0A'
   15    14        ADD                                              ~9      !0, !1
         15        IS_NOT_EQUAL                                             ~9, 2
         16      > JMPNZ                                                    ~10, ->2
         17    > > RETURN                                                   1

Function cointoss:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aERZ5
function name:  cointoss
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'mt_rand'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $0      
          4      > RETURN                                                   $0
    5     5*     > RETURN                                                   null

End of function cointoss

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.44 ms | 1013 KiB | 15 Q