![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP program to compare float values
To compare float values in PHP, the code is as follows −
Example
<?php $val_1 = 56.5325; $val_2 = 90.899; $val_3 = 0.11; if(abs($val_1 - $val_2) < $val_3) { echo "The values are same"; } else { echo "The values are not same"; } ?>
Output
The values are not same
Three values are defined that are floating point numbers. The absolute values of these numbers are compared and relevant message is displayed on the console.
Advertisements