SwiftlyTilting: usability, reusability

Thursday, October 14, 2010

Don’t close your PHP tags!

I saw this post over at sitepoint about whether or not you should close your PHP tags. Apparently there is some debate, though to me it seems pretty clear the choice is to leave them out.

If you’re unaware, the closing ?> tag in PHP files is completely optional. It is only really required if you are mixing HTML and PHP code, which itself is not a particularly good practice. Leaving off the closing tag prevents any erroneous white space or random characters from being sent to the output. It reduces the amount of code and prevents a possible error from occurring.

I can’t really think of a good reason to leave them on (assuming your document is pure PHP). Perhaps if you are from an XML background you will feel compelled to close the tag, but it’s entirely unnecessary in PHP.

Multiple frameworks and libraries such as Zend, CodeIgniter, Drupal and others suggest you to leave off the closing PHP tag as part of their style guide or best practices documentation, and I suggest the same. This is especially important for WinBinder developers (or anyone who uses php-win.exe), where any output sent to the console immediately ends the script.

Some have suggested dropping the need for <?php from php files completely. It’s not a bad suggestion, though i sort of think of it as analogous to #!/bin/sh in unix scripts. Those tags don’t need closing tags either.

So go out there and remove all those nasty ?> tags from your code ;)

WinBinder 2010.10.14 released - WinBinder is a PHP extension for making Windows Applications

I’m now “officially” maintaining WinBinder, so from now on you can get the latest version of WinBinder directly from Winbinder.org’s download page

Read my tutorial on getting started with WinBinder.
Visit the Winbinder Forums if you need more assistance

Changes since 2010.10.01

Added in 2010.10.14
* Fixed bug with return values for wb_sys_dlg_open when using wbc_multiselect
* Made 3rd and 4th parameters of wb_send_message optional

Added in 2010.10.13
* Additional flag parameter for wb_sys_dlg_open that accepts the option WBC_MULTISELECT. If this is enabled, all selected files will be returned as an array.

Monday, September 7, 2009

SwiftlyTilting Wiki (re)Launches!

The wiki at SwiftlyTilting.com has received a face lift. I’ve also added documentation for all of my MediaWiki extensions, and there is a new sandbox area for users to try out Winter and my other extensions as well.

wiki.SwiftlyTilting.com

Validate XHTML | Word Press