Posts Tagged with "programming"

Static vs Non-static methods in PHP: what is faster?

Posted by Stanislav Furman on May 5, 2014

Static vs Non-static methods in PHP: what is faster?

Some theory

As you know there are two types of methods in PHP classes: static and non-static. To be called a non-static method needs an instance of its class, and static method can be called without instantiating of the class. 

In the meantime there are two very common questions:

  • When to use non-static methods and when to use static methods?
  • Is there any performance difference between static and non-static methods?

These are very common dilemmas among PHP developers. Most of developers guess that static methods must work faster because there is no object instance with all its properties involved to the call. Sounds logical. Is that actually true?

As I already mentioned above, and as you already know, the main difference between static and non-static metods is that static methods do not need an instance of the class to be called in the code. It means that for static methods there is no need to create object and keep in the memory. So, at least we can save some memory which can also affect the performance? Hmmm... we'll see...

So, it's time to do some very simple experiments for further analysis.

Continue reading

Backward version compatibility in PHP web application

Posted by Stanislav Furman on February 17, 2014
How to handle backward PHP version compatibility in your web application

Meet AMPPS - a good alternative for XAMPP and WAMP

Posted by Stanislav Furman on October 7, 2013
Meet AMPPS - a good free alternative for XAMPP and WAMP

How to recognize a good programmer

Posted by Stanislav Furman on September 30, 2013

I realized that my article about "How to interview a programmer" is pretty popular, so I decided to extend this topic and share my thoughts about recognizing a good programmer.

Nowadays, it is known that IT guys can make relatively good money in software or web development industry. This makes a lot of people to start learning basics of programming from the school, or sometimes even change their current careers to become programmers. Unfortunately, having a desire is not enough to become a good programmer. Even a number of certificates or diploma from university is not a sufficient sign of a good programmer.

If you are looking for a really good professional you must pay your attention to a certain important indicators.

Continue reading

Happy Programmers' Day

Posted by Stanislav Furman on September 13, 2013

Loose comparison in PHP. Example of breakable functionality.

Posted by Stanislav Furman on September 12, 2013

Recently, I have written about comparisons of numbers with floating point. Here is another important lesson that explains why loose comparison may break the business logic in your PHP application.

Look at the following PHP code. It seems pretty clear and straightforward.

Continue reading