Guys if u execute this code it will output " smaller than 1" ....how!!! the variable is string not integer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys if u execute this code it will output " smaller than 1" ....how!!! the variable is string not integer?

https://code.sololearn.com/wUppUBhflxGi/?ref=app

9th May 2019, 1:13 PM
Omar
Omar - avatar
2 Answers
+ 1
There is an implicit conversion of string to integer using intval function. This function returns integer value on successful conversion, or 0 on failure. If you try to convert your string to integer gives 0 echo intval($c); So, 0<1 and gives output "smaller than 1"
9th May 2019, 1:22 PM
Prokopios Poulimenos
Prokopios Poulimenos - avatar
+ 1
Prokopios Poulimenos Thanks alot☺
9th May 2019, 1:25 PM
Omar
Omar - avatar