3v4l.org

run code in 300+ PHP versions simultaneously
<?php function print_line($fd, $events, $arg) { static $max_requests = 0; $max_requests++; if ($max_requests == 10) { // exit loop after 10 writes event_base_loopexit($arg[1]); } // print the line echo fgets($fd); } // create base and event $base = event_base_new(); $event = event_new(); $fd = STDIN; // set event flags event_set($event, $fd, EV_READ | EV_PERSIST, "print_line", array($event, $base)); // set event base event_base_set($event, $base); // enable event event_add($event); // start event loop event_base_loop($base);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FaV6t
function name:  (null)
number of ops:  31
compiled vars:  !0 = $base, !1 = $event, !2 = $fd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL_BY_NAME                                       'event_base_new'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   20     3        INIT_FCALL_BY_NAME                                       'event_new'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   22     6        FETCH_CONSTANT                                   ~7      'STDIN'
          7        ASSIGN                                                   !2, ~7
   25     8        INIT_FCALL_BY_NAME                                       'event_set'
          9        SEND_VAR_EX                                              !1
         10        SEND_VAR_EX                                              !2
         11        FETCH_CONSTANT                                   ~9      'EV_READ'
         12        FETCH_CONSTANT                                   ~10     'EV_PERSIST'
         13        BW_OR                                            ~11     ~9, ~10
         14        SEND_VAL_EX                                              ~11
         15        SEND_VAL_EX                                              'print_line'
         16        INIT_ARRAY                                       ~12     !1
         17        ADD_ARRAY_ELEMENT                                ~12     !0
         18        SEND_VAL_EX                                              ~12
         19        DO_FCALL                                      0          
   27    20        INIT_FCALL_BY_NAME                                       'event_base_set'
         21        SEND_VAR_EX                                              !1
         22        SEND_VAR_EX                                              !0
         23        DO_FCALL                                      0          
   30    24        INIT_FCALL_BY_NAME                                       'event_add'
         25        SEND_VAR_EX                                              !1
         26        DO_FCALL                                      0          
   32    27        INIT_FCALL_BY_NAME                                       'event_base_loop'
         28        SEND_VAR_EX                                              !0
         29        DO_FCALL                                      0          
         30      > RETURN                                                   1

Function print_line:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/FaV6t
function name:  print_line
number of ops:  17
compiled vars:  !0 = $fd, !1 = $events, !2 = $arg, !3 = $max_requests
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    5     3        BIND_STATIC                                              !3
    7     4        PRE_INC                                                  !3
    9     5        IS_EQUAL                                                 !3, 10
          6      > JMPZ                                                     ~5, ->12
   11     7    >   INIT_FCALL_BY_NAME                                       'event_base_loopexit'
          8        CHECK_FUNC_ARG                                           
          9        FETCH_DIM_FUNC_ARG                               $6      !2, 1
         10        SEND_FUNC_ARG                                            $6
         11        DO_FCALL                                      0          
   15    12    >   INIT_FCALL                                               'fgets'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15        ECHO                                                     $8
   16    16      > RETURN                                                   null

End of function print_line

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.28 ms | 1400 KiB | 15 Q