Posts Tagged ‘kicking’

doubleval vs floatval in php

Monday, July 14th, 2008

Both these functions allow you to quickly pick a float, or double, out of a string.

doubleval vs floatval
doubleval: 4.56571412086 seconds
floatval: 4.35375285149 seconds
Time saved: 0.211961269379 seconds; 4.8684727087%

4% or 211 nanoseconds is next to nothing. I would want to use floatval but I wouldn’t exactly be kicking myself if I slipped a doubleval into my code instead.