Posts Tagged with "php"

Detect an Ajax request in PHP

Posted by Stanislav Furman on August 24, 2017

If you would like to use same PHP code to handle both AJAX and non-AJAX requests, here is a quick and simple trick that you can use to check if the incoming request is AJAX. For our trick we will use a HTTP header called HTTP_X_REQUESTED_WITH. It is supported by all modern browsers that support AJAX. Therefore, it should work in 99% of cases.

Continue reading

Regular expressions? What's that? Part 2.

Posted by Stanislav Furman on June 2, 2014
A good example of how NOT to code.

PHP NG, significant speed-up features coming in PHP 6

Posted by Stanislav Furman on May 15, 2014
PHPNG : significant speedup changes announced in PHP 6 Release

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

Posted by Stanislav Furman on May 4, 2014
What is faster? Comparison of static and non-static class methods in PHP.

Regular expressions? What's that?

Posted by Stanislav Furman on April 29, 2014
A funny example of some silly PHP code.

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

PHP 5.5.5 has been released

Posted by Stanislav Furman on October 17, 2013

Meet AMPPS - a good alternative for XAMPP and WAMP

Posted by Stanislav Furman on October 7, 2013

Meet AMPPS - a good alternative for XAMPP and WAMP  

For those who is looking for a good alternative for XAMMP or WAMP web server stacks. There is a very good option called AMPPS!

The listed number of provided features is impressive. Unlike the other solutions Ampps comes with over 300 PHP web applications, over 1000 PHP classes and libraries including Joomla!, WordPress, Magento, Dolphin and more. 

Very easy to install and manage services with the administration panel. You can easily switch PHP versions with only one-click action.

One thing to notice though... Despite the fact that there are several versions of PHP included, you cannot switch MySQL version which, to be honest, I don't find too critical.

Server configuration is also very straightforward using the web panel. If you mess up the configuration, you can reset it to default state which might be useful sometimes. :)

Also it is very easy to update! The app has built-in updater which makes life way easier when it comes to update Ampps.


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

Floating point comparisons or why prices need to be stored in cents

Posted by Stanislav Furman on September 5, 2013
Comparisons of floating point numbers and potential problem that may occur