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

Posted by Stanislav Furman on September 5, 2013

In PHP you should be careful working with floating point number comparisons because sometimes the result that you get can be unexpected and unpredictable even if it looks pretty obvious. Here is an example. Can you guess what will be the result?

<?php
$a = 0.7;
$b = 0.1;
$c = $a + $b;
if ($c == 0.8) {
   echo '$c == 0.8';
} else {
   echo '$c!=0.8';
}
Continue reading

File search and wildcards in PHP

Posted by Stanislav Furman on June 7, 2013
How to search files in PHP using wildcards and patterns

Do you use Skype? Then Microsoft reads everything you write!

Posted by Stanislav Furman on May 21, 2013

More or less, every clever IT professional understands that big corporations such as Microsoft and Google are able to read correspondences of Gmail and Skype users.

Recently, I found a post where guys from The H Security explain how they found out that Microsoft actually monitors what you write in Skype.

Actually, it is not a big secret. Everyone who uses Skype, must agree with the item that Microsoft could read everything you write (see privacy statement in Skype). Especially I liked that "Skype may capture and manually review instant messages or SMS in connection". However, it's interesting why they pay their attention to HTTPS links and ignore HTTP.

So, if you use Skype for Internet communication, you should know that it is not 100% private.


Concatenating NULL and blank fields in MySQL

Posted by Stanislav Furman on May 17, 2013
How to concatenate empty and null fields in MySQL database

How to protect against SQL injection, and why SQL injection is dangerous

Posted by Stanislav Furman on May 14, 2013
What is SQL injection? Why SQL injection is dangerous? How to protect against SQL injection?

jQuery 2.0 has released!

Posted by Stanislav Furman on April 24, 2013

In this release JQuery core developers threw out the support for Internet Explorer 6, 7 and 8 (Yay!). Thanks to this, the size of the library has decreased by 12% and now it's smaller and faster. It can be even smaller if you make your own build, disabling some of  built-in default modules (there is 12 of them).

Those who need old IE support should remain on the branch 1.x, which will continue supporting old IE versions.

Continue reading

How to trim array elements in PHP in one shot

Posted by Stanislav Furman on April 17, 2013
Remove all leading and trailing white spaces in all PHP array values.

How to get most accurate visitor's IP address in PHP

Posted by Stanislav Furman on April 15, 2013
Learn how to get most accurate user's IP address in PHP.

Why start and run your own blog?

Posted by Stanislav Furman on April 1, 2013

There is a lot of different blogs exist in the Internet. However, every day people set up tons of new blogs, and at the same time huge number of blogs die every day. So, why would people create and run their own blogs?

Continue reading

Reading file list from a mapped Windows network drive

Posted by Stanislav Furman on March 25, 2013
How to read a file list from mapped Windows network drives