2

Some functions in PHP (for ex. phpinfo, var_dump, print_r) has a direct output to browser and to store its result to a variable we need to use ob_* functions.

I cited the example of three these functions. Do you know any more? Is there a list of these functions? Thank you.

11
  • Have a look var_export too Commented Mar 28, 2014 at 18:59
  • echo is such a function :-) Commented Mar 28, 2014 at 19:00
  • echo isn't a function it is a language construct. Commented Mar 28, 2014 at 19:00
  • @Anton The final answer will also depend on the set of extensions you've installed Commented Mar 28, 2014 at 19:01
  • @hek2mgl de2.php.net/manual/en/function.echo.php its also rendered as a function. Commented Mar 28, 2014 at 19:02

1 Answer 1

2

Off the top of my head, I know that PHP's printf function will also echo it's output instead of returning data. But to my knowledge, there's no list out there of all PHP functions that echo information rather than returning it.

A bit of a sidenote though, print_r actually has a boolean optional second parameter that allows you to control whether or not it echos it's output, or returns it.

Sign up to request clarification or add additional context in comments.

1 Comment

and obviously phpinfo(), imagepng(), imagejpg() and so much more :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.