This presentation highlights features in PHP versions 5.3 and 5.4 that are new to the language and help improve how applications are built. We'll look at lambda functions, traits, closures, and more.
(php|architect) Infrequent (lazy) blogger at carouth.com Lover of progress, innovation, and improvement. Developing with PHP since ~2003 Hi! I am Jeff 2 2
function tamu_cas_create_client() { return new Tamu_Http_Client(); } namespace Tamu\Cas; use Tamu\Http\Client as HttpClient; const LIBRARYDIR = __DIR__; class Adapter { function auth() { } } function create_client() { return new HttpClient(); } 33 33
in object context in / Users/jcarouth/Documents/code-bcsphp-092011/ php54closurethis.php on line 14 PHP 5.4.0alpha3 (built Aug 5, 2011) Hello, BCSPHP! 42 42
single inheritance languages such as PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. The semantics of the combination of Traits and classes is defined in a way, which reduces complexity and avoids the typical problems associated with multiple inheritance and Mixins. 51
$this->_ds = $store; } public function getDataStore() { return $this->_ds; } } class User { public function setDataStore($store) { $this->_ds = $store; } public function getDataStore() { return $this->_ds; } } 56
$this->_ds = $store; } public function getDataStore() { return $this->_ds; } } namespace TamuTimes\Models; use Tamu\Dmc\App\DataStore; class Story { use DataStore; } class User { use DataStore; } 57