update page now
PHP 8.5.6 Released!

Voting

: min(one, nine)?
(Example: nine)

The Note You're Voting On

ed.oohay (a) suamhcs_rodnan
22 years ago
Output Buffering even works in nested scopes or might be applied in recursive structures... thought this might save someone a little time guessing and testing :)

<pre><?php
    
    ob_start();              // start output buffer 1
    echo "a";                // fill ob1
        
        ob_start();              // start output buffer 2
        echo "b";                // fill ob2
        $s1 = ob_get_contents(); // read ob2 ("b")
        ob_end_flush();          // flush ob2 to ob1
        
    echo "c";                // continue filling ob1
    $s2 = ob_get_contents(); // read ob1 ("a" . "b" . "c")
    ob_end_flush();          // flush ob1 to browser
    
    // echoes "b" followed by "abc", as supposed to:
    echo "<HR>$s1<HR>$s2<HR>";
    
?></pre>

... at least works on Apache 1.3.28

Nandor =)

<< Back to user notes page

To Top