Write a php program to compare between things that are not integers
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Solution
The comparison operators work for strings as well as numbers. PHP has automatic type conversions that can lead to counter intuitive results when the strings are interpretable as numbers. If you compare a number with a string or the comparison involves numerical strings, then each string is converted to a number and the comparison performed numerically.
In the given example, we have taken three stings and perform comparison between them using comparison operator -
Output of the above code
00007-STR is less than 008
need an explanation for this answer? contact us directly to get an explanation for this answer00004 is less than 00007-STR