I understand that when casting a string to a float, php will evaluate from left to right and stop at the first invalid character. So for example, the string "1-23" will cast to a 1. I need to evaluate the entire string though, so that the string "1-23" would not successfully cast. Is this possible?
spowel4
0
Newbie Poster
Recommended Answers
Jump to PostUse is_numeric function.
if(is_numeric($string)) { $float = (float) $string; }
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.