3v4l.org

run code in 300+ PHP versions simultaneously
<?php file_put_contents("testfile", "testcontent"); function mylock() { $F1 = fopen("testfile","r"); if (flock($F1,LOCK_EX|LOCK_NB)) echo "First lock OK\n"; else echo "First lock FAIL\n"; $F2 = fopen("testfile","r"); if (flock($F2,LOCK_EX|LOCK_NB)) echo "Second lock OK\n"; else echo "Second lock FAIL\n"; } mylock(); echo "Function returned.\n"; mylock(); unlink("testfile");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PFOZu
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'file_put_contents'
          1        SEND_VAL                                                 'testfile'
          2        SEND_VAL                                                 'testcontent'
          3        DO_ICALL                                                 
   11     4        INIT_FCALL                                               'mylock'
          5        DO_FCALL                                      0          
   12     6        ECHO                                                     'Function+returned.%0A'
   13     7        INIT_FCALL                                               'mylock'
          8        DO_FCALL                                      0          
   15     9        INIT_FCALL                                               'unlink'
         10        SEND_VAL                                                 'testfile'
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function mylock:
Finding entry points
Branch analysis from position: 0
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
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
Branch analysis from position: 25
filename:       /in/PFOZu
function name:  mylock
number of ops:  27
compiled vars:  !0 = $F1, !1 = $F2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 'testfile'
          2        SEND_VAL                                                 'r'
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
    6     5        INIT_FCALL                                               'flock'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 6
          8        DO_ICALL                                         $4      
          9      > JMPZ                                                     $4, ->12
         10    >   ECHO                                                     'First+lock+OK%0A'
         11      > JMP                                                      ->13
         12    >   ECHO                                                     'First+lock+FAIL%0A'
    7    13    >   INIT_FCALL                                               'fopen'
         14        SEND_VAL                                                 'testfile'
         15        SEND_VAL                                                 'r'
         16        DO_ICALL                                         $5      
         17        ASSIGN                                                   !1, $5
    8    18        INIT_FCALL                                               'flock'
         19        SEND_VAR                                                 !1
         20        SEND_VAL                                                 6
         21        DO_ICALL                                         $7      
         22      > JMPZ                                                     $7, ->25
         23    >   ECHO                                                     'Second+lock+OK%0A'
         24      > JMP                                                      ->26
         25    >   ECHO                                                     'Second+lock+FAIL%0A'
    9    26    > > RETURN                                                   null

End of function mylock

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.44 ms | 1394 KiB | 23 Q