Post Profile






Importing and aliasing PHP functions - Simon Holywell

As a follow on to my short post about namespaces and functions from a year ago I thought it would be worth covering importing a specific function and aliasing functions via namespace operators too. This has been possible since PHP 5.6, but there is a nice addition in PHP 7 I’ll cover towards the end. In the previous article I demonstrated how you can namespace functions and use them, but as a refresher; you can enclose functions within a namespace just like a class.
read more

share

Related Posts


Memoization or function cache - Simon Holywell

Programming / Web Development : Planet PHP

A little known feature of PHP’s static keyword is that it allows for memoization or function caching. This is a process whereby a functions heavy lifting can be cached so that subsequent calls are faster. It is possible to store any...

How to Use PHP Namespaces, Part 3: Keywords and Autoloading - SitePoint » PHP

Programming / Web Development : Planet PHP

In parts 1 and 2 of this series, we looked at PHP namespace basics, the use operator, and name resolution. In this final article we discuss some of the more advanced namespace options. The __NAMESPACE__ Constant __NAMESPACE__ is a P...

How to Use PHP Namespaces, Part 2: Importing, Aliases, and Name Resolution - SitePoint » PHP

Programming / Web Development : Planet PHP

In part 1, we discussed why PHP namespaces are useful and the namespace keyword. In this article, we examine the use command and the way PHP resolves namespace names. For the purposes of this example, we will define two almost ident...

Namespace PHP functions - Simon Holywell

Programming / Web Development : Planet PHP

With the release of PHP 5.3 namespaces became a reality in PHP and they’ve made so much possible including better autoloading. The majority of the time you’ll be used to seeing them at the top of each class file. They can also be us...

Comments


Copyright © 2016 Regator, LLC