I am new at PHP, and I have a question about Output Buffering.I have this code I found on the net:
ob_start();
system('ipconfig /all');
$contents = ob_get_contents();
ob_end_clean();
$searchFor = "Physical";
$pmac = strpos($contents, $searchFor);
$mac = substr($contents, ($pmac + 36), 17);
return $mac;
It all works fine, but I don't understand the usage of the output buffer here.If I change it to:
$contents = system('ipconfig /all');
$searchFor = "Physical";
$pmac = strpos($contents, $searchFor);
$mac = substr($contents, ($pmac + 36), 17);
return $mac;
It can't seem to filter the contents of $contents to find the mac address.So what does output buffering do for this?
From what I understand about output buffering, it loads all of the page into a single variable, then returns it all at once so the page loads all at once and faster.I can't really see how this would change the output so drastically in this situation.