find undefined classes • Can define multiple functions with spl_autoload_register()! • Zend or PEAR naming conventions – Bear_Polar lives at Bear\Polar.php on the file system
• $a == $b! – Type compare only • $a === $b! – Do $a and $b point to the exact same object • instanceof! – Tests “is, extends, or implements” – if ($dt instanceof DateTime) {…}!
storage • Commonly used when storing objects in a session file or a db • “object” or “document” databases like MongoDB use this heavily • serialize() / unserialize()! – __sleep() and __wakeup()!
Docblock syntax • Annotations are becoming more popular/ powerful • IDEs use this info to help you – Can also generate skeleton docs for you • PHPDocumentor
code • Test the smallest possible chunks (units) of code • Test for results, not implementation • Every requirement/bug should have tests • PHPUnit – Most IDEs can build test skeletons for you
• Requirements: – Supports Oracle and MySQL – Supports bound query parameters – Can fetch, add, update, and remove records – Implements the ExampleDBAL interface
oriented_design%29 • PHPUnit – http://www.phpunit.de (it’s in English) • PHPDocumentor – http://www.phpdoc.org/ • Code Complete 2 – An actual book, and a massive one at that • http://www.phpfreaks.com/tutorial/oo-php-part-2- boring-oo-principles – This covers a lot of the SOLID stuff in more detail