<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/sybase.xml, last change in rev 1.2 --> <refentry id="function.sybase-fetch-object"> <refnamediv> <refname>sybase_fetch_object</refname> <refpurpose>Fetch a row as an object</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>object</type><methodname>sybase_fetch_object</methodname> <methodparam><type>resource</type><parameter>result</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter>object</parameter></methodparam> </methodsynopsis> <para> Returns an object with properties that correspond to the fetched row, or &false; if there are no more rows. </para> <para> <function>sybase_fetch_object</function> is similar to <function>sybase_fetch_assoc</function>, with one difference - an object is returned, instead of an array. </para> <para> Use the second <parameter>object</parameter> to specify the type of object you want to return. If this parameter is omitted, the object will be of type stdClass. </para> <note> <para> As of PHP 4.3.0, this function will no longer return numeric object members. </para> <para> Old behaviour: <screen> <![CDATA[ object(stdclass)(3) { [0]=> string(3) "foo" ["foo"]=> string(3) "foo" [1]=> string(3) "bar" ["bar"]=> string(3) "bar" } ]]> </screen> New behaviour: <screen> <![CDATA[ object(stdclass)(3) { ["foo"]=> string(3) "foo" ["bar"]=> string(3) "bar" } ]]> </screen> </para> </note> <para> <example> <title><function>sybase_fetch_object</function> return as Foo</title> <programlisting role="php"> <![CDATA[ <?php class Foo { var $foo, $bar, $baz; } // {...] $qrh= sybase_query('SELECT foo, bar, baz FROM example'); $foo= sybase_fetch_object($qrh, 'Foo'); $bar= sybase_fetch_object($qrh, new Foo()); // {...] ?> ]]> </programlisting> </example> </para> <para> Speed-wise, the function is identical to <function>sybase_fetch_array</function>, and almost as quick as <function>sybase_fetch_row</function> (the difference is insignificant). </para> <para> See also <function>sybase_fetch_array</function> and <function>sybase_fetch_row</function>. </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:"../../../../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 -->