Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a34ed6838d4b29d38abd504392a4a797 > files > 1249

php-manual-es-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>is_scalar</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual de PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Funciones sobre variables"
HREF="ref.variables.html"><LINK
REL="PREVIOUS"
TITLE="is_resource"
HREF="function.is-resource.html"><LINK
REL="NEXT"
TITLE="is_string"
HREF="function.is-string.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual de PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.is-resource.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.is-string.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.is-scalar"
></A
>is_scalar</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN78507"
></A
><P
>    (PHP 4 &#62;= 4.0.5)</P
>is_scalar&nbsp;--&nbsp;
     Finds whether a variable is a scalar
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN78510"
></A
><H2
>Description</H2
>bool <B
CLASS="methodname"
>is_scalar</B
> ( mixed var)<BR
></BR
><P
>&#13;     <B
CLASS="function"
>is_scalar()</B
> returns <TT
CLASS="constant"
><B
>TRUE</B
></TT
> if the variable
     given by the <TT
CLASS="parameter"
><I
>var</I
></TT
> parameter is a scalar,
     otherwise it returns <TT
CLASS="constant"
><B
>FALSE</B
></TT
>.
    </P
><P
>&#13;     Scalar variables are those containing an <A
HREF="language.types.html#language.types.integer"
><B
CLASS="type"
>integer</B
></A
>, 
     <A
HREF="language.types.float.html"
><B
CLASS="type"
>float</B
></A
>, <A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
> or <A
HREF="missing-stuff.html#language.types.boolean"
><B
CLASS="type"
>boolean</B
></A
>.  
     Types <A
HREF="language.types.array.html"
><B
CLASS="type"
>array</B
></A
>, <A
HREF="language.types.object.html"
><B
CLASS="type"
>object</B
></A
> and resource 
     or not scalar.
     <DIV
CLASS="informalexample"
><A
NAME="AEN78531"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>function show_var($var) {
    if (is_scalar($var)) {
        echo $var;
    } else {
        var_dump($var);
    }
}
$pi = 3.1416;
$proteins = array("hemoglobin", "cytochrome c oxidase", "ferredoxin");

show_var($pi);
// prints: 3.1416

show_var($proteins)
// prints:
// array(3) {
//   [0]=&#62;
//   string(10) "hemoglobin"
//   [1]=&#62;
//   string(20) "cytochrome c oxidase"
//   [2]=&#62;
//   string(10) "ferredoxin"
// }</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
      <B
CLASS="function"
>is_scalar()</B
> does not consider resource
      type values to be scalar as resources are abstract datatypes 
      which are currently based on integers. This implementation detail should 
      not be relied upon, as it may change.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     See also <A
HREF="function.is-bool.html"
><B
CLASS="function"
>is_bool()</B
></A
>,
     <A
HREF="function.is-numeric.html"
><B
CLASS="function"
>is_numeric()</B
></A
>,
     <A
HREF="function.is-float.html"
><B
CLASS="function"
>is_float()</B
></A
>,
     <A
HREF="function.is-int.html"
><B
CLASS="function"
>is_int()</B
></A
>,
     <A
HREF="function.is-real.html"
><B
CLASS="function"
>is_real()</B
></A
>,
     <A
HREF="function.is-string.html"
><B
CLASS="function"
>is_string()</B
></A
>,
     <A
HREF="function.is-object.html"
><B
CLASS="function"
>is_object()</B
></A
>,
     <A
HREF="function.is-array.html"
><B
CLASS="function"
>is_array()</B
></A
>, and
     <A
HREF="function.is-integer.html"
><B
CLASS="function"
>is_integer()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.is-resource.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Inicio</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.is-string.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>is_resource</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.variables.html"
ACCESSKEY="U"
>Subir</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>is_string</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>