Zend Console – get values passed
When using a CLI script with options, I like to use the Zend_Console. If my options are as follows: $console = new Zend_Console_Getopt( array( 'i-s' => 'test option 1', 'e'…
A bunch of ramblings about PHP programming, JQuery, MySQL and other 'stuff'
When using a CLI script with options, I like to use the Zend_Console. If my options are as follows: $console = new Zend_Console_Getopt( array( 'i-s' => 'test option 1', 'e'…
When performing a simple SQL search using Zend_Db_Select, $select->where('name = ?', 'chris'); But what if you want to do a LIKE search? $select->where('name LIKE ?', 'chris%'); Simples.
To allow your Ubuntu server to send emails from PHP, then you need to install postfix. Postfix is a mailer for *nix platforms. So, to install it: sudo apt-get install…
I keep having trouble with this simple calculation! So, here is a little example to get the amount of days between now and the next occurance of July 1st. //set…
If, like me, you need to access some Zend_Application resources (such as multidb resources) – then you need a reference to the Zend_Application and the bootstrap. I use this: if…
This horrendous regular expression will parse a string and return a valid email address from it. $email = "<'Freddy'> fred@live.com"; preg_match('/+(?:\.+)*@(?:(?:*)?\.)+(?:*)?/', $email, $match); echo $match; This will return: fred@live.com Basically,…
I’ve found an excellent online tool, where you can give it a regex, and it will spit out the PHP syntax for use with preg_replace, preg_match, etc. I’m forever getting…
If like me, you use Ant to deploy builds, etc, and you have migrated to Windows 7 – you may well have troubles getting ant to run. It all worked…
When backing up a source code working copy, you don’t always want all the little .svn folders everywhere. You can “export” the working copy, or if you forgot, you have…
Say you have a list of movie titles, and you want to either sort them, or search through them, and some of them have “The ” at the start, for…