3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fo = fopen('lock.txt', 'r+'); if (flock($fo, LOCK_EX)) { // File was not locked, You have locked it successfully right now, do your logic flock($fo, LOCK_UN); // unlock file afer script logic } else { // File is locked right now, don't run script }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/YPSqu
function name:  (null)
number of ops:  16
compiled vars:  !0 = $fo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 'lock.txt'
          2        SEND_VAL                                                 'r%2B'
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
    3     5        INIT_FCALL                                               'flock'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $3      
          9      > JMPZ                                                     $3, ->15
    6    10    >   INIT_FCALL                                               'flock'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 3
         13        DO_ICALL                                                 
         14      > JMP                                                      ->15
   11    15    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
190.45 ms | 1394 KiB | 17 Q