3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unserialize_handler($errno, $errstr) { echo "Сериализуемое значение недопустимо.\n"; } $serialized = 'foo'; set_error_handler('unserialize_handler'); $original = unserialize($serialized); restore_error_handler(); 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/2J0KI
function name:  (null)
number of ops:  41
compiled vars:  !0 = $serialized, !1 = $original, !2 = $base, !3 = $event, !4 = $fd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'foo'
    8     1        INIT_FCALL                                               'set_error_handler'
          2        SEND_VAL                                                 'unserialize_handler'
          3        DO_ICALL                                                 
    9     4        INIT_FCALL                                               'unserialize'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !1, $7
   10     8        INIT_FCALL                                               'restore_error_handler'
          9        DO_ICALL                                                 
   29    10        INIT_FCALL_BY_NAME                                       'event_base_new'
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !2, $10
   30    13        INIT_FCALL_BY_NAME                                       'event_new'
         14        DO_FCALL                                      0  $12     
         15        ASSIGN                                                   !3, $12
   32    16        FETCH_CONSTANT                                   ~14     'STDIN'
         17        ASSIGN                                                   !4, ~14
   35    18        INIT_FCALL_BY_NAME                                       'event_set'
         19        SEND_VAR_EX                                              !3
         20        SEND_VAR_EX                                              !4
         21        FETCH_CONSTANT                                   ~16     'EV_READ'
         22        FETCH_CONSTANT                                   ~17     'EV_PERSIST'
         23        BW_OR                                            ~18     ~16, ~17
         24        SEND_VAL_EX                                              ~18
         25        SEND_VAL_EX                                              'print_line'
         26        INIT_ARRAY                                       ~19     !3
         27        ADD_ARRAY_ELEMENT                                ~19     !2
         28        SEND_VAL_EX                                              ~19
         29        DO_FCALL                                      0          
   37    30        INIT_FCALL_BY_NAME                                       'event_base_set'
         31        SEND_VAR_EX                                              !3
         32        SEND_VAR_EX                                              !2
         33        DO_FCALL                                      0          
   40    34        INIT_FCALL_BY_NAME                                       'event_add'
         35        SEND_VAR_EX                                              !3
         36        DO_FCALL                                      0          
   42    37        INIT_FCALL_BY_NAME                                       'event_base_loop'
         38        SEND_VAR_EX                                              !2
         39        DO_FCALL                                      0          
         40      > RETURN                                                   1

Function unserialize_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2J0KI
function name:  unserialize_handler
number of ops:  4
compiled vars:  !0 = $errno, !1 = $errstr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ECHO                                                     '%D0%A1%D0%B5%D1%80%D0%B8%D0%B0%D0%BB%D0%B8%D0%B7%D1%83%D0%B5%D0%BC%D0%BE%D0%B5+%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BD%D0%B5%D0%B4%D0%BE%D0%BF%D1%83%D1%81%D1%82%D0%B8%D0%BC%D0%BE.%0A'
    5     3      > RETURN                                                   null

End of function unserialize_handler

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/2J0KI
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
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   15     3        BIND_STATIC                                              !3
   17     4        PRE_INC                                                  !3
   19     5        IS_EQUAL                                                 !3, 10
          6      > JMPZ                                                     ~5, ->12
   21     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          
   25    12    >   INIT_FCALL                                               'fgets'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15        ECHO                                                     $8
   26    16      > RETURN                                                   null

End of function print_line

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.69 ms | 1400 KiB | 21 Q