User Tools

Site Tools


uphp:functions:is_float

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:is_float [2017/03/09 16:48]
jeff
uphp:functions:is_float [2021/09/13 05:57] (current)
Line 1: Line 1:
 ======is_float====== ======is_float======
 +
 <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge> <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge>
  
-Return 1 if the variable is a float+Check if variable is a <html><b><span style="color:green">float<span style="color:black"></b></html>
  
 ====Description==== ====Description====
-<well size="sm"><html><span style="font-size:125%;color:green;">int + 
-<span style="color:black;"></html>[[is_float]] +<well size="sm"><html> 
-<html>+<span style="font-size:125%;color:green">int 
-<span style="color:green;">mixed +<span style="color:black">is_float ( 
-<span style="color:blue;">$variable +<span style="color:green">mixed 
-<span style="color:black;">)+<span style="color:blue">$variable 
 +<span style="color:black">)
 </html></well> </html></well>
  
-Check if a variable or value is a floating point number+Check to see if a variable or value is of type <html><b><span style="color:green">float</b></html> (a floating point number)
  
-====Parameters==== +====Parameter====
-<html><span style="color:blue;"><b>variable</b><span style="color:black;"></html>:  Variable or expression to be evaluated+
  
-====Return Value==== +<html><b><span style="color:blue">$variable<span style="color:black"></b></html>:  Variable or expression to be evaluated 
-1 (true) if float, 0 (false) if not a float+ 
 +====Return Values==== 
 + 
 +<html><b><span style="color:green">Integer<span style="color:black"></b></html>:  1 (true) if <html><b><span style="color:green">float<span style="color:black"></b></html>, 0 (false) if not a float
  
 ====Examples==== ====Examples====
 +
 <code php> <code php>
 <? <?
-$x=1; +  $x=1; 
-print(is_float($x)); //outputs 0, $x is an integer +  print(is_float($x)); // outputs 0, $x is an integer 
-$y=1.0; +  $y=1.0; 
-print(is_float($y)); //outputs 1, $y is a float +  print(is_float($y)); // outputs 1, $y is a float 
-$z="1.0"; +  $z="1.0"; 
-print(is_float($z)); //outputs 0, $z is a string+  print(is_float($z)); // outputs 0, $z is a string
 ?> ?>
 </code> </code>
  
-====Note==== +====Notes==== 
-To test if a variable is a number or a numeric string (such as form input, which is always a string), you should use [[is_numeric()]].+ 
 +This function checks ONLY the type of the variable, not the data that it holds! 
 + 
 +To test if a variable contains a number or is a numeric string (such as form input, which is always a string), you should use [[is_numeric()]].
  
 ====See Also==== ====See Also====
-[[is_int()]] - Return 1 if the variable is an integer 
  
-[[is_numeric()]] - Return 1 if the value is numeric (integer, float or string)+[[is_int()]] - Check if a variable is an <html><b><span style="color:green">integer<span style="color:black"></b></html> 
 + 
 +[[is_numeric()]] - <html>Check if value is numeric (<b><span style="color:green">int<span style="color:black"></b><b><span style="color:green">float<span style="color:black"></b> or numeric <b><span style="color:green">string<span style="color:black"></b>)</html> 
 + 
 +[[is_string()]] - Check if a variable is a <html><b><span style="color:green">string<span style="color:black"></b></html>
  
-[[is_string()]] - Return 1 if the variable is a string+[[is_array()]] - Check if variable is an <html><b><span style="color:green">array<span style="color:black"></b></html>
  
-[[is_array()]] - Return 1 if the variable is an array+[[isset()]] - Check if variable exists
  
 [[uphp:variables|uPHP Variable Types and Limits]] [[uphp:variables|uPHP Variable Types and Limits]]
  
uphp/functions/is_float.1489078129.txt.gz · Last modified: 2021/09/13 05:56 (external edit)