mirror of
https://github.com/php/doc-it.git
synced 2026-03-24 15:42:46 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@351144 c90b9560-bf6c-de11-be94-00142212c4b1
114 lines
3.1 KiB
XML
114 lines
3.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: 03083e6a6633a433d4269d7c24b7be0bd546ebc6 Maintainer: pastore Status: ready -->
|
|
<!-- CREDITS: darvina -->
|
|
<refentry xml:id="function.floatval" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>floatval</refname>
|
|
<refpurpose>Restituisce il valore di una variabile di tipo float</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>float</type><methodname>floatval</methodname>
|
|
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
La funzione restituisce il valore di tipo <type>float</type> di <parameter>var</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>var</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Può anche essere di tipo scalare. La funzione <function>floatval</function> non dovrebbe essere usata
|
|
sugli oggetti, facendolo emetterà un errore di livello
|
|
<constant>E_NOTICE</constant> e restituirà 1.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Il valore in virgola mobile della variabile. Gli array vuoti restituiscono 0, gli array
|
|
non vuoti restituiscono 1.
|
|
</para>
|
|
<para>
|
|
Le stringhe molto probabilmente restituiscono 0 anche se questo dipende dai
|
|
caratteri più a sinistra della stringa. Si applicano le regole
|
|
comuni del
|
|
<link linkend="language.types.float.casting">casting del float</link>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Esempio di uso di <function>floatval</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$var = '122.34343The';
|
|
$float_value_of_var = floatval($var);
|
|
echo $float_value_of_var; // 122.34343
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Esempio di <function>floatval</function> con caratteri più a sinistra non numerici</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$var = 'The122.34343';
|
|
$float_value_of_var = floatval($var);
|
|
echo $float_value_of_var; // 0
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>boolval</function></member>
|
|
<member><function>intval</function></member>
|
|
<member><function>strval</function></member>
|
|
<member><function>settype</function></member>
|
|
<member><link linkend="language.types.type-juggling">Type juggling</link></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|