update page now
PHP 8.5.6 Released!

Voting

: max(six, four)?
(Example: nine)

The Note You're Voting On

Mark Clements
11 years ago
Note that, unlike PHP variables which make efficient use of memory, getting the contents of the output buffer results in a new copy of the buffer being made.  This can end up massively increasing the memory requirements of your script if your output is large.

Example code:

<?php

print(memory_get_usage() . "<br>");

ob_start();

for ($i = 0; $i < 5000000; $i++)
    print(" ");

print(memory_get_usage() . "<br>");

$foo = ob_get_contents();

print(memory_get_usage() . "<br>");

ob_end_flush();

?>

Output:

  351664
 5359152
10359256

<< Back to user notes page

To Top