floatval

(PHP 4 >= 4.2.0, PHP 5)

floatval -- Restituisce il valore di una variabile di tipo float

Descrizione

float floatval ( mixed var )

La funzione restituisce il valore di tipo float di var.

Elenco dei parametri

var

Può anche essere di tipo scalare. La funzione floatval() non può essere usata con variabili di tipo array oppure object.

Valori restituiti

Il valore in virgola mobile della variabile.

Esempi

Esempio 1. Esempio di uso di floatval()

<?php
$var
= '122.34343The';
$float_value_of_var = floatval($var);
echo
$float_value_of_var; // 122.34343
?>

Vedere anche:

intval()
strval()
settype()
Type juggling