PHP output buffering nightmare

While going through some code at work, I noticed that some output buffering wasnt being ended correctly.

The number of ob_start()'s werent being ended properly, causing a buffer to carry through all the way to the end of the page.

Eventually it was found to be a simple mistake.
The use of "ob_clean()" instead of "ob_end_clean()".
$ret = ob_get_contents();
ob_clean();
return $ret;
Please! Just use "ob_start()" and "ob_get_clean()" !!!
They're both one line, respect the current buffering level and incredibly simple to use!

Eclipse - Windows/Unix new line formatting

Sometimes you have to do work with Unix/Linux machines and the differences in new line encodings can be annoying, especially when doing diffs or merges.

Luckily, Eclipse has options for this which covers a global and per-project scope.

To change the option globally:
1. Open the preferences dialog.
2. Select "General" > "Workspace".
3. Change the "New text file line delimiter" to "Other" and select your preference.

To change the option on a per-project basis:
1. Open the project.
2. View the project properties.
3. Select "Resource"
4. Change it from "Inherited from container" to "Other" and select your preference.

If your project is using UTF8, you might want to take the time to change it to UTF8 while you're at it.
 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog