cvs: phpdoc /en/functions funchand.xml /en/language control-structures.xml

From: Date: Mon, 21 May 2001 23:16:31 +0000
Subject: cvs: phpdoc /en/functions funchand.xml /en/language control-structures.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969335496@lists.php.net to get a copy of this message
ssb Mon May 21 16:16:31 2001 EDT Modified files: /phpdoc/en/functions funchand.xml /phpdoc/en/language control-structures.xml Log: * documented "declare" and ticks Index: phpdoc/en/functions/funchand.xml diff -u phpdoc/en/functions/funchand.xml:1.11 phpdoc/en/functions/funchand.xml:1.12 --- phpdoc/en/functions/funchand.xml:1.11 Wed May 16 11:33:20 2001 +++ phpdoc/en/functions/funchand.xml Mon May 21 16:16:31 2001 @@ -561,6 +561,58 @@ </refsect1> </refentry> + <refentry id="function.register-tick-function"> + <refnamediv> + <refname>register_tick_function</refname> + <refpurpose> + Register a function for execution on each tick + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>void + <function>register_tick_function</function> + </funcdef> + <paramdef>string <parameter>func</parameter></paramdef> + <paramdef>mixed <parameter><optional>arg</optional></parameter>...</paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + Registers the function named by <parameter>func</parameter> to be + executed when a <link + linkend="control-structures.declare">tick</link> is + called.</simpara> + </refsect1> + </refentry> + + <refentry id="function.unregister-tick-function"> + <refnamediv> + <refname>unregister_tick_function</refname> + <refpurpose> + De-register a function for execution on each tick + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>void + <function>unregister_tick_function</function> + </funcdef> + <paramdef>string <parameter>func</parameter></paramdef> + <paramdef>mixed <parameter><optional>arg</optional></parameter>...</paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + De-registers the function named by <parameter>func</parameter> so it is + no longer executed when a <link + linkend="control-structures.declare">tick</link> is + called.</simpara> + </refsect1> + </refentry> + </reference> <!-- Keep this comment at the end of the file Index: phpdoc/en/language/control-structures.xml diff -u phpdoc/en/language/control-structures.xml:1.28 phpdoc/en/language/control-structures.xml:1.29 --- phpdoc/en/language/control-structures.xml:1.28 Mon Apr 9 14:50:14 2001 +++ phpdoc/en/language/control-structures.xml Mon May 21 16:16:31 2001 @@ -432,6 +432,7 @@ </para> </sect1> + <sect1 id="control-structures.foreach"> <title><literal>foreach</literal></title> <para> @@ -811,6 +812,46 @@ </para> </sect1> + <sect1 id="control-structures.declare"> + <title><literal>declare</literal></title> + <simpara> + The <literal>declare</literal> statement is used to temporarily + change the state of the parser in a block of code. Here's how it looks: + </simpara> + <para> + <informalexample> + <programlisting role="php"> +function tick() +{ + static $i; + printf("[tick i=%d]\n", ++$i); +} + +register_tick_function("tick"); + +declare (ticks = 2) { + 1; 2; 3; +} +</programlisting> + </informalexample> + This example shows the only implemented parser parameter today: + ticks. A tick is an event that occurs for every + <replaceable>N</replaceable> low-level statements executed by the + parser, where <replaceable>N</replaceable> is specified in the + <literal>declare</literal> statement. The example above will print: + <computeroutput>[tick i=1] +[tick i=2] +</computeroutput> + </para> + <simpara> + Ticks is well suited for implementing simple multitasking, + backgrounded IO and many other things in PHP. + </simpara> + <simpara> + See also <function>register_tick_function</function> and + <function>unregister_tick_function</function>. + </simpara> + </sect1> <sect1 id="function.require"> <title><function>require</function></title> <simpara>

« previous php.doc (#969335496) next »