3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (strnatcmp(phpversion(),'5.4.7') >= 0) { $address="127.0.0.1"; $port=9878; echo "I am here"; set_time_limit (0); if(false==($socket= socket_create(AF_INET,SOCK_STREAM, SOL_TCP))) { echo "could not create socket"; } socket_bind($socket, $address, $port) or die ("could not bind socket"); socket_listen($socket); if(($client=socket_accept($socket))) echo "client is here"; sleep(60); socket_close($socket); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 49
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
2 jumps found. (Code = 47) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 26
Branch analysis from position: 49
filename:       /in/5fEHj
function name:  (null)
number of ops:  50
compiled vars:  !0 = $address, !1 = $port, !2 = $socket, !3 = $client
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'strnatcmp'
          1        INIT_FCALL                                               'phpversion'
          2        DO_ICALL                                         $4      
          3        SEND_VAR                                                 $4
          4        SEND_VAL                                                 '5.4.7'
          5        DO_ICALL                                         $5      
          6        IS_SMALLER_OR_EQUAL                                      0, $5
          7      > JMPZ                                                     ~6, ->49
    4     8    >   ASSIGN                                                   !0, '127.0.0.1'
    5     9        ASSIGN                                                   !1, 9878
    6    10        ECHO                                                     'I+am+here'
    7    11        INIT_FCALL                                               'set_time_limit'
         12        SEND_VAL                                                 0
         13        DO_ICALL                                                 
    8    14        INIT_FCALL_BY_NAME                                       'socket_create'
         15        FETCH_CONSTANT                                   ~10     'AF_INET'
         16        SEND_VAL_EX                                              ~10
         17        FETCH_CONSTANT                                   ~11     'SOCK_STREAM'
         18        SEND_VAL_EX                                              ~11
         19        FETCH_CONSTANT                                   ~12     'SOL_TCP'
         20        SEND_VAL_EX                                              ~12
         21        DO_FCALL                                      0  $13     
         22        ASSIGN                                           ~14     !2, $13
         23        BOOL_NOT                                         ~15     ~14
         24      > JMPZ                                                     ~15, ->26
   10    25    >   ECHO                                                     'could+not+create+socket'
   12    26    >   INIT_FCALL_BY_NAME                                       'socket_bind'
         27        SEND_VAR_EX                                              !2
         28        SEND_VAR_EX                                              !0
         29        SEND_VAR_EX                                              !1
         30        DO_FCALL                                      0  $16     
         31      > JMPNZ_EX                                         ~17     $16, ->34
         32    > > EXIT                                                     'could+not+bind+socket'
         33*       BOOL                                             ~17     <true>
   13    34    >   INIT_FCALL_BY_NAME                                       'socket_listen'
         35        SEND_VAR_EX                                              !2
         36        DO_FCALL                                      0          
   14    37        INIT_FCALL_BY_NAME                                       'socket_accept'
         38        SEND_VAR_EX                                              !2
         39        DO_FCALL                                      0  $19     
         40        ASSIGN                                           ~20     !3, $19
         41      > JMPZ                                                     ~20, ->43
   15    42    >   ECHO                                                     'client+is+here'
   16    43    >   INIT_FCALL                                               'sleep'
         44        SEND_VAL                                                 60
         45        DO_ICALL                                                 
   17    46        INIT_FCALL_BY_NAME                                       'socket_close'
         47        SEND_VAR_EX                                              !2
         48        DO_FCALL                                      0          
   19    49    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.6 ms | 1392 KiB | 21 Q