Category: PHP

Posted on: October 21, 2010 Posted by: JJ Comments: 0

PHP Design Patterns

How many PHP design patterns do you know? Singleton? Factory? Subject? Observer? Strategy? Decorator? Facade? I think I’ll stop here (There are just too many to list). Where it boils down to is this: Each pattern has it’s own use to solve problems and allow you to maintain the code. …

Posted on: October 7, 2010 Posted by: JJ Comments: 0

Grab remote page’s title

Ever wonder how you can grab remote page’s title? Here’s how: [php] function get_page_title($url){ oif( !($content = @file_get_contents($url)) ) return false; oif( preg_match(‘/<title>(.*?)<\/title>/imsxe’, $content, $match)) { oreturn trim($match[1]); o} else { oreturn false; o} } [/php]

Posted on: October 7, 2010 Posted by: JJ Comments: 0

Autoload classes

Takes a bite out of including all your class files… http://php.net/manual/en/language.oop5.autoload.php http://www.codeforest.net/autoload-your-classes-in-php