News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Dynamic global functions in PHP
October 22, 2007 @ 11:12:00

On the SitePoint PHP blog, there's a quick tutorial from Troels Knak-Nielsen about the creation and use of dynamic global functions in your PHP application:

Like many others, I prefer to use procedural PHP as a template language. While PHP's syntax makes it a practical choice for this, there is a problem with embedding dynamic content. [...] A single letter, regular function is undoubtedly the simplest way to extend PHP's syntax. Thinking about it, it's fairly obvious, but it just never occurred to me. [...] There is a problem though; Since this is such a good name for a function, chances are that someone else would use it for something different, or perhaps even for the same.

As a more viable solution, he recommends going dynamic and creating fumctions (via the call_user_func_* functions) and an addition to the $GLOBALS superglobal to make calling the custom function simpler.

0 comments voice your opinion now!
dynamic global function calluserfunc superglobal dynamic global function calluserfunc superglobal


blog comments powered by Disqus

Similar Posts

Chris Renner's Blog: Gerrymandered Code: Extending Zend_Registry to globalize session vars

Community News: PHP on .NET Dynamic Language Runtime

AnyExample.com: 5 useful PHP functions for MySQL data fetching

Chris Shiflett's Blog: Google Code Search for Security Vulnerabilities

Chris Hartjes' Blog: Tutorial: Integrating PHP/SWF Charts with CakePHP


Community Events

Don't see your event here?
Let us know!


library laravel language series conference community api introduction laravel5 extension framework voicesoftheelephpant example version podcast interview opinion release php7 unittest

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework