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:
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
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
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
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!";