3v4l.org

run code in 300+ PHP versions simultaneously
<?php $descSpec = array( array('pipe','r'), // stdin array('pipe','w'), // stdout array('pipe','w') // stderr ); $proc = proc_open('bash', $descSpec, $pipes,'/tmp',array()); if(!is_resource($proc)){ throw new Exception("Could not open bash process"); } $stdin = &$pipes[0]; $stdout = &$pipes[1]; $stderr = &$pipes[2]; stream_set_blocking($stdout,0); stream_set_blocking($stderr,0); fwrite($stdin, "pwd\n"); fflush($stdin); $write = null; $except = null; $stdoutArr = array($stdout); $rv = stream_select($stdoutArr,$write,$except,1); $strIn = stream_get_line($stdout,4096); var_export(array('streamSelect_returnVal'=>$rv,'stdout_strRead'=>$strIn));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZs9N
function name:  (null)
number of ops:  59
compiled vars:  !0 = $descSpec, !1 = $proc, !2 = $pipes, !3 = $stdin, !4 = $stdout, !5 = $stderr, !6 = $write, !7 = $except, !8 = $stdoutArr, !9 = $rv, !10 = $strIn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        INIT_FCALL                                               'proc_open'
          2        SEND_VAL                                                 'bash'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !2
          5        SEND_VAL                                                 '%2Ftmp'
          6        SEND_VAL                                                 <array>
          7        DO_ICALL                                         $12     
          8        ASSIGN                                                   !1, $12
    9     9        TYPE_CHECK                                  512  ~14     !1
         10        BOOL_NOT                                         ~15     ~14
         11      > JMPZ                                                     ~15, ->16
   10    12    >   NEW                                              $16     'Exception'
         13        SEND_VAL_EX                                              'Could+not+open+bash+process'
         14        DO_FCALL                                      0          
         15      > THROW                                         0          $16
   12    16    >   FETCH_DIM_W                                      $18     !2, 0
         17        ASSIGN_REF                                               !3, $18
   13    18        FETCH_DIM_W                                      $20     !2, 1
         19        ASSIGN_REF                                               !4, $20
   14    20        FETCH_DIM_W                                      $22     !2, 2
         21        ASSIGN_REF                                               !5, $22
   16    22        INIT_FCALL                                               'stream_set_blocking'
         23        SEND_VAR                                                 !4
         24        SEND_VAL                                                 0
         25        DO_ICALL                                                 
   17    26        INIT_FCALL                                               'stream_set_blocking'
         27        SEND_VAR                                                 !5
         28        SEND_VAL                                                 0
         29        DO_ICALL                                                 
   19    30        INIT_FCALL                                               'fwrite'
         31        SEND_VAR                                                 !3
         32        SEND_VAL                                                 'pwd%0A'
         33        DO_ICALL                                                 
   20    34        INIT_FCALL                                               'fflush'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                                 
   22    37        ASSIGN                                                   !6, null
   23    38        ASSIGN                                                   !7, null
   24    39        INIT_ARRAY                                       ~30     !4
         40        ASSIGN                                                   !8, ~30
   25    41        INIT_FCALL                                               'stream_select'
         42        SEND_REF                                                 !8
         43        SEND_REF                                                 !6
         44        SEND_REF                                                 !7
         45        SEND_VAL                                                 1
         46        DO_ICALL                                         $32     
         47        ASSIGN                                                   !9, $32
   26    48        INIT_FCALL                                               'stream_get_line'
         49        SEND_VAR                                                 !4
         50        SEND_VAL                                                 4096
         51        DO_ICALL                                         $34     
         52        ASSIGN                                                   !10, $34
   27    53        INIT_FCALL                                               'var_export'
         54        INIT_ARRAY                                       ~36     !9, 'streamSelect_returnVal'
         55        ADD_ARRAY_ELEMENT                                ~36     !10, 'stdout_strRead'
         56        SEND_VAL                                                 ~36
         57        DO_ICALL                                                 
         58      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
209.14 ms | 1404 KiB | 27 Q