- Fastest things in PHP are the language constructs.
- They are highly optimized in the interpreter
- Don’t require calling external libraries
- Don’t call a function if there is a language construct. As an example, using a casting operator like (int) $total is much more efficient than using the function intval($foo)
- Function calling generate considerably amount of overhead. Using a language construct avoid
- isset() and unset() are both language constructs, even though they mostly act like functions. However calling them does not generate the function overhead.
Some common language constructs are:
- echo()
- empty()
- isset()
- unset()
- eval()
- exit()
- die()
- include()
- include_once()
- require()
- require_once()
- return
July 3, 2008 at 5:14 am
Efficiency is an important aspect of programming. I am going to write a post about using different programming styles in order to minimize resource consumption. There is enough information on the web, I know, but I kind of wanted to collect most important parts on one long page.
August 19, 2008 at 9:04 pm
I have been looking around for language constructs in PHP and they seem to be quite hard to find. Thanks a lot for posting the useful ones. I am too preparing for ZCE exam.
Regards,
Jack
October 3, 2008 at 4:53 pm
Than you Ahsan for this post, the list of Language Constructs have come in very useful for my blog.
I noticed you are a ZCE I soon hope to be soon as I learn PHP by writing everything in the Blog:
http://zend.is-hacked.com
Much thanks for the help
Adam.
May 30, 2009 at 5:02 pm
thanks for info, just know what is language contract means thru your articles
March 26, 2011 at 8:02 pm
[...] starać się zamieniać użycie funkcji na language constructs [...]