PHP floor() Function Last Updated : 29 Jun, 2022 Comments Improve Suggest changes Like Article Like Report We sometimes need to round down the float values to the next lowest integer in our maths problems. PHP provides a built-in function floor() to get this task done through our PHP script. The floor() function in PHP rounds down the float value to the next lowest integer value. Syntax: float floor(value) Parameters: This function accepts the single parameter value which is rounded down to the next lowest integer. Return Value: The return type is a float value. It returns the next lowest integer value as a float which is rounded down, only if necessary. Examples: Input : floor(1.9) Output : 1 Input : floor(-1.8) Output : -2 Input : floor(4) Output : 4 Note: floor() function is opposite to ceil() function in PHP Below programs illustrate the floor() function in PHP. When a positive decimal number is passed. PHP <?php echo floor(2.8); ?> Output: 2When a negative decimal number is passed. PHP <?php echo floor(-3.4); ?> Output: -4When a number without decimal places is passed. PHP <?php echo floor(2); ?> Output: 2 Reference: https://www.php.net/manual/en/function.floor Comment More infoAdvertise with us Next Article PHP floor() Function girish_nikam Follow Improve Article Tags : Web Technologies PHP PHP Programs Similar Reads PHP Callback Functions In PHP, the callback functions are related to the dynamic behavior and flexibility in code execution. They are used to pass custom logic or functions as arguments to other functions, letting developers change how a function behaves without changing its main structure. This makes the code more reusab 5 min read Anonymous recursive function in PHP Anonymous recursive function is a type of recursion in which function does not explicitly call another function by name. This can be done either comprehensively, by using a higher order function passing in a function as an argument and calling that function. It can be done implicitly, via reflection 2 min read How hash Function works in PHP ? Hashing Functions play a crucial role in securing sensitive data by converting it into a fixed-size string of characters, often a hash value or checksum. PHP provides several built-in hashing functions for various purposes, such as password hashing, data integrity verification, and more. The Hashing 2 min read PHP | Check if a variable is a function To determine whether a passed argument is a function or not, Few of the most preferred methods are shown below. Using is_callable() Function: It is an inbuilt function in PHP which is used to verify the contents of a variable in called as a function. It can check that a simple variable contains the 3 min read Function overloading and Overriding in PHP Function overloading and overriding is the OOPs feature in PHP. In function overloading, more than one function can have same method signature but different number of arguments. But in case of function overriding, more than one functions will have same method signature and number of arguments. Funct 3 min read How to find out where a function is defined using PHP ? When we do projects then it includes multiple modules where each module divided into multiple files and each file containing many lines of code. So when we declare a function somewhere in the files and forget that what the function was doing or want to change the code of that function but can't find 3 min read How to Declare a Global Variable in PHP? Global variables refer to any variable that is defined outside of the function. Global variables can be accessed from any part of the script i.e. inside and outside of the function.Syntax:$variable_name = data; The below programs illustrate how to declare global variables. Example 1:php<?php // D 2 min read What is the difference between a language construct and a âbuilt-inâ function in PHP ? In programming, language constructs and built-in functions are often misinterpreted with one another due to the fact that both have more or less alike behavior. But they differ from each other in the way the PHP interpreter interprets them. Every programming language consists of tokens and structure 3 min read PHP Programs PHP Programs is a collection of coding examples and practical exercises designed to help beginners and experienced developers. This collection covers a wide range of questions based on Array, Stirng, Date, Files, ..., etc. Each programming example includes multiple approaches to solve the problem.Wh 7 min read PHP fmod() Function fmod stands for Floating Modulo. Modulo calculates the remainder of a division which is generally noted with the '%' symbol. However, the general modulo expression expects both the divisor and dividend to be of integer type, this is a great limitation to such an important operation. In PHP the fmod( 2 min read Like