Sometimes you have a dynamic sentence with a amount in it. How to show the plural or not?

See the simple example:

//$users is an array is this example
$echoUsers = (count($users) == 1) ? $users.' user registered' : $users.' users registered';

echo $echoUsers;

Zebra tables are very easy to read and they are very nice to look at if you style them correctly. But how do you accomplish this?

Well, here I am with a very basic example. There are a lot of methods but this is the one I’m using. Continue Reading »

There are several ways to make your source code readable.

echo "Hello World\n";
//or
echo "Hello World\r";
//or
echo "Hello World\r\n";

But I don’t like the double quote’s in this notation because when I’m echo html tags into it, I’ll have to escape allt he double quotes. This is why I prefer the following usage.

echo 'Hello World!'.PHP_EOL;

EOL stands for End of Line.

Sometimes the server is running on windows and the EOL tag is this define tag by default. This is the point where a simple hack comes in…

Continue Reading »

Top of Page