Category: PHP

Increment & Decrement Operators in PHP

Increment and decrement operators in PHP increment and decrement value by 1.  There are 4 types of increment and decrement operators. Pre-Increment:  ++$variable Post-Increment:  $variable++ Pre-Decrement:  –$variable Post-Decrement:  $variable– Example for increment and decrement operators is given below. <?php $pre_increment = 10; $post_increment = 10; $pre_decrement = 10; $post_decrement = 10; //Pre-Increment: 11 echo 'Pre-Increment:

Math Functions in PHP

Apart from arithmetic operators, we also have Math functions in PHP.  Click Here for list of Math functions in PHP.  There are few commonly used Math functions given below. Is_int:  This function will check if the passed value is integer or not and return true or false. Is_float:  This function will check if the passed

Arithmetic Operators in PHP

Like any other programming language, we do have integer and float data types in PHP.  Integers are whole numbers, can have both positive and negative values like -1, -2, 1, 3 etc.  Floats are known as decimal numbers like 1.25, 3.2 etc.  Using integers and floats, we can perform numerical calculations like addition, subtraction, division

More String Functions in PHP

As you know by now, string functions are very useful in manipulating a string.  The list of predefined string functions is huge, so we will discuss only mostly commonly used string functions. Strlen:  This string function will return length of a string. Ucfirst:  This string function will change case of first letter of the string

StrToLower() & StrToUpper() String Functions

There are numerous string functions in PHP.  Two of them are strtolower() means string to lower case and strtoupper() string to upper case.  You can use these 2 string functions in case you want to change the case of a string completely.  Example of these 2 functions is given below. <?php $hello = "Hello World!";