3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f = fopen("lock", "w") or die("Cannot create lock file."); if(!flock($f, LOCK_EX | LOCK_NB)) { print ("Exiting due to duplicated instance."); exit(); } print("1"); sleep(20);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IHENP
function name:  (null)
number of ops:  21
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 'lock'
          2        SEND_VAL                                                 'w'
          3        DO_ICALL                                         $1      
          4        ASSIGN                                           ~2      !0, $1
          5      > JMPNZ_EX                                         ~2      ~2, ->8
          6    > > EXIT                                                     'Cannot+create+lock+file.'
          7*       BOOL                                             ~2      <true>
    5     8    >   INIT_FCALL                                               'flock'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 6
         11        DO_ICALL                                         $3      
         12        BOOL_NOT                                         ~4      $3
         13      > JMPZ                                                     ~4, ->16
    6    14    >   ECHO                                                     'Exiting+due+to+duplicated+instance.'
    7    15      > EXIT                                                     
   11    16    >   ECHO                                                     '1'
   12    17        INIT_FCALL                                               'sleep'
         18        SEND_VAL                                                 20
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.14 ms | 1395 KiB | 19 Q