PHP – Take advantage of language constructs

  • 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:

  1. echo()
  2. empty()
  3. isset()
  4. unset()
  5. eval()
  6. exit()
  7. die()
  8. include()
  9. include_once()
  10. require()
  11. require_once()
  12. return

7 Responses to “PHP – Take advantage of language constructs”

  1. gf4e Says:

    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.

  2. jack Says:

    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.


  3. Adam Says:

    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:

    Much thanks for the help

  4. Anton Ongsono Says:

    thanks for info, just know what is language contract means thru your articles

  5. Co najbardziej spowalnia skrypty PHP? « mindexception: out of context Says:

    […] starać się zamieniać użycie funkcji na language constructs […]

  6. Josephine Says:

    Hi there, this weekend is nice in favor of me, for the reason that this point in time i am reading this great informative article here at my residence.

  7. Alysa Says:

    “PHP – Take advantage of language constructs | Think Different” was in fact a wonderful article.
    If merely there were far more websites such as this
    particular one on the actual net. Anyhow, thank you for
    your personal time, Jenny

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: