PHP Curiosities

As I am working with PHP practically every day, I would like to share some of my "vast" knowlege ;) with you.
Currently I use PHP in my job for programming complete internet applications. Starting to work on this was also the start with PHP for me.
That is why I quickly recognized that PHP is a very mighty programming language. Therefore I was very surprised that most people using PHP use it as a simple and easy web-programming language only, mostly programming quick'n'dirty-style.
You can see this whenever you download some of the many sources which the PHP community shares with everyone.
Thus, here's some "Do"'s and "Don't"s or just some work-arounds...:

+++ NEWS +++ NEWS +++ NEWS +++ NEWS +++
    + Array_search does not find the first element in an array... array_search bug
    + Something about function return values: if (function())
    + the News about PHP curiosities can now be found using the News Button
    + new: PHP types
    + added some new lines and example to strpos().
    + added classes behaviour to Naming.
    - to come: PHP and downward compatibility

The "empty()"-Problem Have you ever noticed that a variable containing 0 is empty?? There's more to know...
PHP-naming convention It is known that PHP is not a very strict language, but the naming conventions are quite strange.
Parameter handling How does PHP handle parameters for functions?
Finding strings in strings (strpos) There's a very strange thing about the function strpos()!!
PHP types Something about types of variables in PHP, especially the new boolean type.
checking function return values using empty() There's a strange thing with the check using empty() of function return values.

Visitors until now:

© retosphere.de
this page last updated: 28.11.2013