Unix and Linux Discussions Tagged with var |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
7 |
4,406 |
Shell Programming and Scripting |
|
|
|
14 |
3,645 |
Shell Programming and Scripting |
|
|
|
4 |
5,783 |
SuSE |
|
|
|
3 |
4,435 |
AIX |
|
|
|
1 |
5,174 |
Solaris |
|
|
|
1 |
2,370 |
Solaris |
|
|
|
0 |
1,262 |
Software Releases - RSS News |
|
|
|
10 |
6,274 |
Shell Programming and Scripting |
|
|
|
2 |
1,789 |
Shell Programming and Scripting |
|
|
|
0 |
678 |
Software Releases - RSS News |
|
|
|
0 |
826 |
Software Releases - RSS News |
|
|
|
5 |
8,836 |
Solaris |
|
|
|
5 |
62,672 |
Shell Programming and Scripting |
|
|
|
2 |
3,135 |
Shell Programming and Scripting |
|
|
|
0 |
5,485 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
31,444 |
IP Networking |
|
|
|
1 |
6,076 |
UNIX for Advanced & Expert Users |
|
|
|
3 |
4,772 |
Solaris |
|
|
|
20 |
6,560 |
Shell Programming and Scripting |
|
|
|
1 |
1,961 |
Solaris |
|
|
|
3 |
5,997 |
Solaris |
|
|
|
12 |
4,130 |
Shell Programming and Scripting |
|
|
|
2 |
59,170 |
AIX |
|
|
|
4 |
15,878 |
UNIX for Dummies Questions & Answers |
|
|
|
8 |
4,290 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
2,192 |
Shell Programming and Scripting |
|
|
|
2 |
4,277 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
1,988 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
4,355 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
4,131 |
Filesystems, Disks and Memory |
|
|
|
1 |
1,648 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
14,946 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
8,676 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
3,199 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
4,030 |
HP-UX |
|
|
|
3 |
5,344 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
10,785 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
4,480 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
7,598 |
Shell Programming and Scripting |
|
|
|
2 |
3,259 |
UNIX for Advanced & Expert Users |
FLOATVAL(3) 1 FLOATVAL(3)
floatval - Get float value of a variable
SYNOPSIS
float floatval (mixed $var)
DESCRIPTION
Gets the float value of $var.
PARAMETERS
o $var
- May be any scalar type. floatval(3) should not be used on objects, as doing so will emit an E_NOTICE level error and return 1.
RETURN VALUES
The float value of the given variable. Empty arrays return 0, non-empty arrays return 1.
Strings will most likely return 0 although this depends on the leftmost characters of the string. The common rules of float casting apply.
EXAMPLES
Example #1
floatval(3) Example
<?php
$var = '122.34343The';
$float_value_of_var = floatval($var);
echo $float_value_of_var; // 122.34343
?>
Example #2
floatval(3) non-numeric leftmost characters Example
<?php
$var = 'The122.34343';
$float_value_of_var = floatval($var);
echo $float_value_of_var; // 0
?>
SEE ALSO
boolval(3), intval(3), strval(3), settype(3), Type juggling.
PHP Documentation Group FLOATVAL(3)