I have seen a lot of ob_get_clean()
the last while. Typically I have done $test .= 'test'
I'm wondering if one is faster and/or better than the other.
Here is the code using ob_get_clean()
:
ob_start();
foreach($items as $item) {
echo '<div>' . $item . '</div>';
}
$test = ob_get_clean();
Here is the code using $test .= 'test'
:
$test = '';
foreach($items as $item) {
$test .= '<div>' . $item . '</div>';
}
Which is better?