Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > fedef0ce54a3761fc1862157672b700c > files > 3788

php-manual-ar-5.1.6-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Type Operators</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Handleiding"
HREF="index.html"><LINK
REL="UP"
TITLE="Operators"
HREF="language.operators.html"><LINK
REL="PREVIOUS"
TITLE="Array Operators"
HREF="language.operators.array.html"><LINK
REL="NEXT"
TITLE="Control Structures"
HREF="control-structures.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="sect1"
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"
>PHP Handleiding</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="language.operators.array.html"
ACCESSKEY="P"
>Terug</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Hoofdstuk 10. Operators</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="control-structures.html"
ACCESSKEY="N"
>Volgende</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="language.operators.type"
>Type Operators</A
></H1
><P
>&#13;    PHP has a single type operator: <VAR
CLASS="literal"
>instanceof</VAR
>. 
    <VAR
CLASS="literal"
>instanceof</VAR
> is used to determine whether a given
    object is of a specified <A
HREF="language.oop.html"
>object class</A
>.
   </P
><P
>&#13;    The <VAR
CLASS="literal"
>instanceof</VAR
> operator was introduced in PHP 5.
    Before this time <A
HREF="function.is-a.html"
><B
CLASS="function"
>is_a()</B
></A
> was used but
    <A
HREF="function.is-a.html"
><B
CLASS="function"
>is_a()</B
></A
> has since been deprecated in favor of
    <VAR
CLASS="literal"
>instanceof</VAR
>. 
   </P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN4021"
></A
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>&#60;?php
class A { }
class B { }

$thing = new A;

if ($thing instanceof A) {
    echo 'A';
}
if ($thing instanceof B) {
    echo 'B';
}
?&#62;</PRE
></TD
></TR
></TABLE
><P
>&#13;     As <VAR
CLASS="varname"
>$thing</VAR
> is an <A
HREF="language.types.object.html"
><B
CLASS="type"
>object</B
></A
> of type A, but
     not B, only the block dependent on the A type will be executed:
    </P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>A</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
><P
>&#13;    See also <A
HREF="function.get-class.html"
><B
CLASS="function"
>get_class()</B
></A
> and 
    <A
HREF="function.is-a.html"
><B
CLASS="function"
>is_a()</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="language.operators.array.html"
ACCESSKEY="P"
>Terug</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Begin</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="control-structures.html"
ACCESSKEY="N"
>Volgende</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Array Operators</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="language.operators.html"
ACCESSKEY="U"
>Omhoog</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Control Structures</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>