3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP class cat { public function show_output($prepend, $output = '') {echo $prepend . $output;} public function show_out($output) {echo $output;} } $cat = new cat(); $cat->show_output('Files: ', trim(`ls`)); // this gives invalid args to shell_exec $cat->show_output('Files: ', `ls`); // this causes a segmentation fault $cat->show_out(`ls`); // this causes a segmentation fault function show_outputa($prepend, $output) {echo $prepend . $output;} show_outputa('Files: ', `ls`); // this works as expected
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sPht8
function name:  (null)
number of ops:  34
compiled vars:  !0 = $cat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $1      'cat'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
    7     3        INIT_METHOD_CALL                                         !0, 'show_output'
          4        SEND_VAL_EX                                              'Files%3A+'
          5        INIT_FCALL                                               'trim'
          6        INIT_FCALL                                               'shell_exec'
          7        SEND_VAL                                                 'ls'
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                         $5      
         11        SEND_VAR_NO_REF_EX                                       $5
         12        DO_FCALL                                      0          
    8    13        INIT_METHOD_CALL                                         !0, 'show_output'
         14        SEND_VAL_EX                                              'Files%3A+'
         15        INIT_FCALL                                               'shell_exec'
         16        SEND_VAL                                                 'ls'
         17        DO_ICALL                                         $7      
         18        SEND_VAR_NO_REF_EX                                       $7
         19        DO_FCALL                                      0          
    9    20        INIT_METHOD_CALL                                         !0, 'show_out'
         21        INIT_FCALL                                               'shell_exec'
         22        SEND_VAL                                                 'ls'
         23        DO_ICALL                                         $9      
         24        SEND_VAR_NO_REF_EX                                       $9
         25        DO_FCALL                                      0          
   12    26        INIT_FCALL                                               'show_outputa'
         27        SEND_VAL                                                 'Files%3A+'
         28        INIT_FCALL                                               'shell_exec'
         29        SEND_VAL                                                 'ls'
         30        DO_ICALL                                         $11     
         31        SEND_VAR                                                 $11
         32        DO_FCALL                                      0          
         33      > RETURN                                                   1

Function show_outputa:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sPht8
function name:  show_outputa
number of ops:  5
compiled vars:  !0 = $prepend, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        CONCAT                                           ~2      !0, !1
          3        ECHO                                                     ~2
          4      > RETURN                                                   null

End of function show_outputa

Class cat:
Function show_output:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sPht8
function name:  show_output
number of ops:  5
compiled vars:  !0 = $prepend, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
          2        CONCAT                                           ~2      !0, !1
          3        ECHO                                                     ~2
          4      > RETURN                                                   null

End of function show_output

Function show_out:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sPht8
function name:  show_out
number of ops:  3
compiled vars:  !0 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        ECHO                                                     !0
          2      > RETURN                                                   null

End of function show_out

End of class cat.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.26 ms | 1403 KiB | 18 Q