Filed under: IT world news

Some tricks of PHP code optimization

by Web Software design on May 9th, 2010

Tags
  • No Tags
Share Comments (0)

1 – Initializes variables before use.2 – Spend time studying PHP , it is a language in continuous process of growth and its characteristics are changing over time.3 – Increase one variable in a method is as fast as , just do it in a function.4 – Increasing global variable is twice as slow a local variable.5 – Increase a local variable in a method is faster. Almost the same as calling a local variable in a function.6 – Increase a undefined variable is 9 or 10 times slower than an already pre-declared.7 – The fact declare a global variable despite not use any function in your script lags, PHP has to check if the variable exists.8 – Calling a function with a parameter takes about the same time than 7-8 operations with local variables, and the same method call would result in about 15 operations.9 – If you need to know the timestamp of access to a script, consider using $ _SERVER ['REQUEST_TIME'] instead of time ().10 – $ row ['id'] is 7 times faster than $ row [id].11 – $ localvar is up to 15 times faster than function inc () ($ localvar;).12 – The PHP scripts are “compiled” each time they are executed unless you save the code object in a cache. Different PHP compilation tools improve performance up to 100%.

Related Internet news :

Related Articles
No comments currently exist for this post.

Why don't you make one?

Get a GravatarLeave a Reply

Name: « Required

Email Address: « Required

Website URL: « Optional

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>