Pragmatism in the real world

Where is php ?

A question came up on the phpwomen channel today about how to find the path to php executable for use in cron scripts. The answer that came back very quickly to use which or whereis. It turns out that the server in question is a shared host with a control panel for access to cron and ftp to upload your files. A test proved that shell_exec() wasn't going to work too. After discussing it for… continue reading.

Recursion

PHPWomen are running an article contest at the moment. All you have to do is write an article for the Best Practices forum and you could win a Zend Studio for Eclipse license and a a 1-year subscription to Linux Pro magazine! Obviously, never one to miss an opportunity to win free swag, I've entered with an article on recursion. Now it's your turn. Write a article on a best practice when coding PHP, but… continue reading.

PHPWM March Meeting: Symfony

On Tuesday, PHPWM had a meeting at PSL Connect's offices where Darren Beale talked about Symfony. I took a few pictures and have stuck them up on Flickr. I should have taken my other lens though as the 50mm isn't wide enough for taking pictures in room! It was a very good talk that covered the basics of Symfony and what it can do. At the start, Darren asked us which frameworks we use and… continue reading.

Code cleanliness guidelines from Etienne Kneuss

I don't often post links to articles I read via my RSS reader as I assume that most people who read this blog also read sites like Planet PHP, PHP Developer or DevZone. Having said that, Etienne Kneuss has posted an article aimed at less experienced PHP programmers providing some quick guidelines to code cleanliness which are actually a very good reminder to us all.

Where to set up your view?

With Zend_Layout on the horizon, I've been looking at how to use it and it will remove the need for my own front controller plugin which I call SiteTemplate. As a result, I need to find a new home for the view customisation stuff I do in SiteTemplate. My current plan is to create a new front controller plugin called ViewSetup (for want of a better name!) that contains just the view setup stuff from… continue reading.

PHPAbstract

If you read DevZone, then you'll notice that Cal's looking for some PHP Abstract advertising. I'm always up for free books, so there's my link Cal! (Though I doubt that technorati picks up my little blog!) More seriously, PHPAbstract is worth listening to. Unusually for a podcast, each episode is short (around 10 mins) so that I actually get to listen to a whole episode without being distracted. They have episodes by many (lots?) well… continue reading.

PHPWM Social

I've just come back from the PHPWM social for this month. We meet monthly and alternate between social and technical meets. This month, we met at the Hopwood House pub in Alvechurch, south of Birmingham. We talked geek for a few hours and I highly recommend joining your local PHP user group as it's a great way to meet people who don't look askance at you when you mention MVC!

preg_last_error() returns No Error on preg_match() Failure

A question came up on a mailing list that I subscribe to that I thought interesting. Consider this code: <?php $result = preg_match("/href='(.*)", 'blah'); $error = preg_last_error(); if($error === PREG_NO_ERROR) { echo "No Error\n"; } else { echo "An Error Occurred\n"; } var_dump($result); The output is: Warning: preg_match(): No ending delimiter '/' found in /var/www/preg_test.php on line 2 No Error bool(false) As you can see the pattern passed to preg_match is invalid as it is… continue reading.

PHP Editors

Everyone has their favourite coding editor and as this topic has just come up on the Zend mailing list and comes up regularly on the Sitepoint forums, I thought I'd list the editors I use. For my main heavy lifting, I use Zend Studio. In my opinion, nothing can touch it's autocomplete functionality. I especially like the way that it uses phpdoc's @return construct for autocomplete on class objects that are returned from functions. Obviously,… continue reading.

PHP West Midlands Meeting

Last night was the first meeting of the West Midlands PHP User Group. The phpwm is a mailing list group of around 100 members and now we've placed some names to faces. Jono Bacon organised the meeting, and Open Advantage graciously hosted it and even provided food! To get us started, we had three short talks: David Goodwin of Pale Purple talked about Smarty and separation of business code from display code. Elliot of Open… continue reading.