PHP: Quickly Generate An Array From Variables With The compact() Function

Do you want to build an array in PHP, which should contain existing variables? Well, there is an easy way to do this. PHP has a very cool function for this to do. You can use the variable’s name as the key and the variables value as the value.

Read morePHP: Quickly Generate An Array From Variables With The compact() Function

PHP: How Can I Find Out, Whether A Number Is Odd Or Even With The Modulo Operator?

There is a simple way in PHP to find out, wheather a number is odd or even. All you need is the modulo operator.

What is the modulo operator?

The modulo operator in PHP is represented by an %. With this operator you can determine the rest of an interger division.
Here’s an example:

Read morePHP: How Can I Find Out, Whether A Number Is Odd Or Even With The Modulo Operator?