PHP Complete list of functions and statments that

2019-09-10 10:58发布

问题:

Note: "output" is meant to meant to data that streams out of php; Eg, stdout, output buffer, data that is returned to an incomming web request. "Output" is not to mean, the value that a functions that returns.

Note: "function and statements" is meant to refer to anything that a php script can do; What could approximately be referred to as a callable, or a statement; Or that PHP Docs refer to as a Language Construct. Or anything else that can in some way, make php output something somewhere.

I need to locate anything that can output in a php project, a prerequisite for finding all these things is determine a list of what can output.


I suggest this is different to a similar question because that questioned asked specifically about things that output to a browser, assumedly via an Apache host. Whereas this question is intended about php-cli, or any way of running php, which may include, but does not target PHP on Apache.

I appreciate that this is an awkward question and that php is an awkward interpreter to which no absolute list can probably be derived. I'd still like to expand my knowledge of things that can output as to better beware.

回答1:

  • echo
  • var_dump
  • printr
  • var_export
  • closing brace ?> (if opened with <?php, or '<?, or <?=)
  • alt closing brace </script> (if opened with <script language="php">)
  • alt closing brace ASP %? (if opened with <%, or <%=)
  • print
  • printf
  • flush
  • ob_flush
  • ob_end_flush
  • debug_zval_dump
  • debug_print_backtrace
  • readfile
  • fpassthru
  • phpinfo
  • phpcredits
  • highlight_string
  • highlight_file
  • some image* functions
  • exit, die

This list was assorted by manually navigating the "see also" sections of known php output functions. These results stand on the shoulders of thous listed on a similar question.

I tried to parse the php documentation's standalone copy but found it too sloppy to parse meaningful. Thous are available here: http://php.net/download-docs.php