<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="splfileobject.setcsvcontrol" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>SplFileObject::setCsvControl</refname>
  <refpurpose>Set the delimiter, enclosure and escape character for CSV</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="SplFileObject">
   <modifier>public</modifier> <type>void</type><methodname>SplFileObject::setCsvControl</methodname>
   <methodparam choice="opt"><type>string</type><parameter>separator</parameter><initializer>","</initializer></methodparam>
   <methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>"\""</initializer></methodparam>
   <methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\\"</initializer></methodparam>
  </methodsynopsis>
  <para>
   Sets the delimiter, enclosure and escape character for parsing CSV fields.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>separator</parameter></term>
     <listitem>
      <para>
       The field delimiter (one single-byte character only).
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>enclosure</parameter></term>
     <listitem>
      <para>
       The field enclosure character (one single-byte character only).
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>escape</parameter></term>
     <listitem>
      <para>
       The field escape character (at most one single-byte character).
       An empty string (<literal>""</literal>) disables the proprietary escape mechanism.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.void;
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>7.4.0</entry>
       <entry>
        The <parameter>escape</parameter> parameter now also accepts an empty
        string to disable the proprietary escape mechanism.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><methodname>SplFileObject::setCsvControl</methodname> example</title>
    <programlisting role="php">
<![CDATA[
<?php
$file = new SplFileObject("data.csv");
$file->setFlags(SplFileObject::READ_CSV);
$file->setCsvControl('|');
foreach ($file as $row) {
    list ($fruit, $quantity) = $row;
    // Do something with values
}
?>
]]>
    </programlisting>
    <para>Contents of data.csv</para>
    <programlisting role="txt">
<![CDATA[
<?php
apples|20
bananas|14
cherries|87
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><methodname>SplFileObject::getCsvControl</methodname></member>
    <member><methodname>SplFileObject::fgetcsv</methodname></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
-->
