cvs: phpdoc-fr /reference/funchand reference.xml /reference/funchand/functions call-user-func-array.xml call-user-func.xml create-function.xml
func-get-arg.xml func-get-args.xml func-num-args.xml function-exists.xml get-defined-functions.xml register-shutdown-function.xml
register-tick-function.xml unregister-tick-function.xml

From: Date: Mon, 22 Sep 2003 13:25:07 +0000
Subject: cvs: phpdoc-fr /reference/funchand reference.xml /reference/funchand/functions call-user-func-array.xml call-user-func.xml create-function.xml
func-get-arg.xml func-get-args.xml func-num-args.xml function-exists.xml get-defined-functions.xml register-shutdown-function.xml
register-tick-function.xml unregister-tick-function.xml
Groups: php.doc.fr 
Request: Send a blank email to doc-fr+get-780@lists.php.net to get a copy of this message
dams Mon Sep 22 09:25:07 2003 EDT Modified files: /phpdoc-fr/reference/funchand reference.xml /phpdoc-fr/reference/funchand/functions call-user-func-array.xml call-user-func.xml create-function.xml func-get-arg.xml func-get-args.xml func-num-args.xml function-exists.xml get-defined-functions.xml register-shutdown-function.xml register-tick-function.xml unregister-tick-function.xml Log: keep up with en

Index: phpdoc-fr/reference/funchand/reference.xml diff -u phpdoc-fr/reference/funchand/reference.xml:1.2 phpdoc-fr/reference/funchand/reference.xml:1.3 --- phpdoc-fr/reference/funchand/reference.xml:1.2 Mon Apr 15 20:53:34 2002 +++ phpdoc-fr/reference/funchand/reference.xml Mon Sep 22 09:25:06 2003 @@ -1,14 +1,39 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <reference id="ref.funchand"> <title>Fonctions</title> <titleabbrev>Fonctions</titleabbrev> - <partintro> - <para> + + <partintro> + <section id="funchand.intro"> + &reftitle.intro; + <para> Ces fonctions effectuent les manipulations li&eacute;es &agrave; la gestion des fonctions. - </para> - </partintro> + </para> + </section> + + <section id="funchand.requirements"> + &reftitle.required; + &no.requirement; + </section> + + <section id="funchand.installation"> + &reftitle.install; + &no.install; + </section> + + <section id="funchand.configuration"> + &reftitle.runtime; + &no.config; + </section> + + <section id="funchand.constants"> + &reftitle.constants; + &no.constants; + </section> + + </partintro> &reference.funchand.functions; Index: phpdoc-fr/reference/funchand/functions/call-user-func-array.xml diff -u phpdoc-fr/reference/funchand/functions/call-user-func-array.xml:1.1 phpdoc-fr/reference/funchand/functions/call-user-func-array.xml:1.2 --- phpdoc-fr/reference/funchand/functions/call-user-func-array.xml:1.1 Sun Apr 14 20:28:46 2002 +++ phpdoc-fr/reference/funchand/functions/call-user-func-array.xml Mon Sep 22 09:25:06 2003 @@ -10,19 +10,19 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>call_user_func_array</methodname> - <methodparam><type>string</type><parameter>function_name</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>paramarr</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>mixed</type><methodname>call_user_func_array</methodname> + <methodparam><type>callback</type><parameter>function</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>paramarr</parameter></methodparam> + </methodsynopsis> <para> <function>call_user_func_array</function> appelle la fonction utilisateur <parameter>function_name</parameter> avec les param&egrave;tres <parameter>paramarr</parameter>, rassembl&eacute;s dans un tableau. - Par exemple: - <informalexample> + <example> + <title>Exemple avec <function>call_user_func_array</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ function debug($var, $val) echo "***DEBUGGING\nVARIABLE: $var\nVALUE:"; if (is_array($val) || is_object($val) || is_resource($val)) @@ -31,14 +31,16 @@ echo "\n$val\n"; echo "***\n"; } + $c = mysql_connect(); -$host = $HTTP_SERVER_VARS["SERVER_NAME"]; +$host = $_SERVER["SERVER_NAME"]; + call_user_func_array ('debug', array("host", $host)); call_user_func_array ('debug', array("c", $c)); -call_user_func_array ('debug', array("HTTP_POST_VARS", $HTTP_POST_VARS)); -?&gt; +call_user_func_array ('debug', array("_POST", $_POST)); +]]> </programlisting> - </informalexample> + </example> </para> <para> Voir aussi @@ -46,12 +48,6 @@ <function>call_user_method</function> et <function>call_user_method_array</function>. </para> - <note> - <para> - <function>call_user_func_array</function> a &eacute;t&eacute; ajout&eacute; - en version PHP 4.05. - </para> - </note> </refsect1> </refentry> Index: phpdoc-fr/reference/funchand/functions/call-user-func.xml diff -u phpdoc-fr/reference/funchand/functions/call-user-func.xml:1.1 phpdoc-fr/reference/funchand/functions/call-user-func.xml:1.2 --- phpdoc-fr/reference/funchand/functions/call-user-func.xml:1.1 Sun Apr 14 20:28:48 2002 +++ phpdoc-fr/reference/funchand/functions/call-user-func.xml Mon Sep 22 09:25:06 2003 @@ -10,30 +10,56 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>call_user_func</methodname> - <methodparam><type>string</type><parameter>function_name</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>mixed</type><methodname>call_user_func</methodname> + <methodparam><type>callback</type><parameter>function</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> + </methodsynopsis> <para> <function>call_user_func</function> appelle la fonction utilisateur <parameter>function_name</parameter>, et lui passe les param&egrave;tres <parameter>parameter</parameter>. - Par exemple : - <informalexample> + <example> + <title>Exemple avec <function>call_user_func</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function barbier ($type) { print "Vous vouliez une coupe $type, pas de probl&egrave;me"; } - call_user_func('barbier', "iroquois"); + + call_user_func('barbier', "&agrave; la one again"); call_user_func('barbier', "militaire"); call_user_func('barbier', "au bol"); -?&gt; +?> +]]> </programlisting> - </informalexample> + </example> </para> + <para> + Les m&eacute;thodes d'objets peuvent &ecirc;tre appel&eacute;es statiquement + en passant <literal>array($objectname, $methodname)</literal> au + param&egrave;tre <parameter>function</parameter>. + <example> + <title>Exemple avec <function>call_user_func</function> et une m&eacute;thode de classe</title> + <programlisting role="php"> +<![CDATA[ +<?php +class maclasse { + function dit_bonjour() { + print "Bonjour!\n"; + } +} + +$classname = "maclasse"; + +call_user_func(array($classname,'dit_bonjour')); +?> +]]> + </programlisting> + </example> + </para> <para> Voir aussi <function>call_user_func_array</function>, Index: phpdoc-fr/reference/funchand/functions/create-function.xml diff -u phpdoc-fr/reference/funchand/functions/create-function.xml:1.2 phpdoc-fr/reference/funchand/functions/create-function.xml:1.3 --- phpdoc-fr/reference/funchand/functions/create-function.xml:1.2 Thu Aug 14 10:48:53 2003 +++ phpdoc-fr/reference/funchand/functions/create-function.xml Mon Sep 22 09:25:06 2003 @@ -34,14 +34,16 @@ Cr&eacute;ation d'une fonction anonyme avec <function>create_function</function> </title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $newfunc = create_function('$a,$b','return "ln($a) + ln($b) = ".log($a * $b);'); echo "Nouvelle fonction anonyme : $newfunc\n"; echo $newfunc(2,M_E)."\n"; // affichera : // Nouvelle fonction anonyme : lambda_1 // ln(2) + ln(2.718281828459) = 1.6931471805599 -?&gt; +?> +]]> </programlisting> </example> Ou, pour pouvoir appliquer une fonction g&eacute;n&eacute;rique @@ -52,15 +54,17 @@ <function>create_function</function> </title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function process($var1, $var2, $farr) { - for ($f=0; $f &lt; count($farr); $f++) + for ($f=0; $f < count($farr); $f++) echo $farr[$f]($var1,$var2)."\n"; } -// cr&eacute;ation d'une s&eacute;rie de fonction math&eacute;matiques -$f1 = 'if ($a&gt;=0) {return "b*a^2 = ".$b*sqrt($a);} else {return FALSE;}'; + +// Cr&eacute;ation d'une s&eacute;rie de fonction math&eacute;matiques +$f1 = 'if ($a>=0) {return "b*a^2 = ".$b*sqrt($a);} else {return FALSE;}'; $f2 = "return \"min(b^2+a, a^2,b) = \".min(\$a*\$a+\$b,\$b*\$b+\$a);"; -$f3 = 'if ($a&gt; 0 &amp;&amp; $b != 0) {return "ln(a)/b = ".log($a)/$b;} else {return FALSE;}'; +$f3 = 'if ($a> 0 && $b != 0) {return "ln(a)/b = ".log($a)/$b;} else {return FALSE;}'; $farr = array( create_function('$x,$y', 'return "un peu de trigo : ".(sin($x) + $x*cos($y));'), create_function('$x,$y', 'return "une hypot&eacute;nuse: ".sqrt($x*$x + $y*$y);'), @@ -68,55 +72,62 @@ create_function('$a,$b', $f2), create_function('$a,$b', $f3) ); + echo "\nUtilisation de la premi&egrave;re liste de fonctions anonymes\n"; echo "param&eacute;tres: 2.3445, M_PI\n"; process(2.3445, M_PI, $farr); + // Maintenant une liste de fonction sur cha&icirc;ne de caract&egrave;res $garr = array( create_function('$b,$a','if (strncmp($a,$b,3) == 0) return "** \"$a\" '. 'et \"$b\"\n** Ces cha&icirc;nes de ressemblent!! (regarde les trois premiers caract&egrave;res)";'), create_function('$a,$b','; return "CRCs: ".crc32($a)." , ".crc32(b);'), - create_function('$a,$b','; return "similarit&eacute;(a,b) = ".similar_text($a,$b,&amp;$p)."($p%)";') + create_function('$a,$b','; return "similarit&eacute;(a,b) = ".similar_text($a,$b,&$p)."($p%)";') ); echo "\nUtilisation de la secondes liste de fonctions anonymes\n"; process("Twas brilling and the slithy toves", "Twas the night", $garr); -?&gt; +?> +]]> </programlisting> - </example> - Et lorsque vous utilisez le code ci-dessus, l'affichage va &ecirc;tre - <informalexample> + <para> + Et lorsque vous utilisez le code ci-dessus, l'affichage sera + </para> <programlisting> +<![CDATA[ Utilisation de la premi&egrave;re liste de fonctions anonymes param&eacute;tres: 2.3445, M_PI -Un peu de trigo: -1.6291725057799 -Une hypot&eacute;nuse: 3.9199852871011 +un peu de trigo : -1.6291725057799 +une hypot&eacute;nuse: 3.9199852871011 b*a^2 = 4.8103313314525 min(b^2+a, a^2,b) = 8.6382729035898 -ln(a/b) = 0.27122299212594 -Utilisation de la seconde liste de fonctions anonymes +ln(a)/b = 0.27122299212594 + +Utilisation de la secondes liste de fonctions anonymes ** "Twas the night" et "Twas brilling and the slithy toves" ** Ces cha&icirc;nes de ressemblent!! (regarde les trois premiers caract&egrave;res) CRCs: -725381282 , 1908338681 similarit&eacute;(a,b) = 11(45.833333333333%) +]]> </programlisting> - </informalexample> + </example> Mais l'utilisation la plus courante des fonctions lambda est la fonction de callback, par exemple lors de l'utilisation de <function>array_walk</function> ou <function>usort</function> <example> <title>Utilisation de fonctions anonymes comme fonction de callback</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $av = array("la ","une ","cette ","une certaine "); -array_walk($av, create_function('&amp;$v,$k','$v = $v."maison";')); -print_r($av); // En PHP 3 utilisez <function>var_dump</function> +array_walk($av, create_function('&$v,$k','$v = $v."maison";')); +print_r($av); // En PHP 3 utilisez var_dump() // affiche: // Array // ( -// [0] =&gt; la maison -// [1] =&gt; une maison -// [2] =&gt; cette maison -// [3] =&gt; une certaine maison +// [0] => la maison +// [1] => une maison +// [2] => cette maison +// [3] => une certaine maison // ) // un tableau de cha&icirc;ne class&eacute; par taille $sv = array("petite","moyenne","tres longue","vraiment tres longue"); @@ -124,10 +135,10 @@ // affiche: // Array // ( -// [0] =&gt; petite -// [1] =&gt; moyenne -// [2] =&gt; tres longue -// [3] =&gt; vraiment tres longue +// [0] => petite +// [1] => moyenne +// [2] => tres longue +// [3] => vraiment tres longue // ) // Tri par ordre de taille d&eacute;croissant usort($sv, create_function('$a,$b','return strlen($b) - strlen($a);')); @@ -135,12 +146,13 @@ // outputs: // Array // ( -// [0] =&gt; vraiment tres longue -// [1] =&gt; tres longue -// [2] =&gt; moyenne -// [3] =&gt; petite +// [0] => vraiment tres longue +// [1] => tres longue +// [2] => moyenne +// [3] => petite // ) -?&gt; +?> +]]> </programlisting> </example> </para> Index: phpdoc-fr/reference/funchand/functions/func-get-arg.xml diff -u phpdoc-fr/reference/funchand/functions/func-get-arg.xml:1.1 phpdoc-fr/reference/funchand/functions/func-get-arg.xml:1.2 --- phpdoc-fr/reference/funchand/functions/func-get-arg.xml:1.1 Sun Apr 14 20:28:48 2002 +++ phpdoc-fr/reference/funchand/functions/func-get-arg.xml Mon Sep 22 09:25:06 2003 @@ -25,23 +25,26 @@ <simpara> Si <parameter>arg_num</parameter> est plus grand que le nombre d'arguments pass&eacute;s, une alerte est g&eacute;n&eacute;r&eacute;e - et la fonction retourne <literal>FALSE</literal>. + et la fonction retourne &false;. </simpara> <para> - <informalexample> + <example> + <title>Exemple avec <function>func_get_arg</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function foo() { $numargs = func_num_args(); - echo "Nombre d'arguments: $numargs&lt;br&gt;\n"; - if ($numargs &gt;= 2) { - echo "Le second argument est: " . func_get_arg (1) . "&lt;br&gt;\n"; + echo "Nombre d'arguments: $numargs<BR>\n"; + if ($numargs >= 2) { + echo "Le second argument est: " . func_get_arg (1) . "<BR>\n"; } } foo(1, 2, 3); -?&gt; +?> +]]> </programlisting> - </informalexample> + </example> </para> <simpara> <function>func_get_arg</function> peut &ecirc;tre utilis&eacute; Index: phpdoc-fr/reference/funchand/functions/func-get-args.xml diff -u phpdoc-fr/reference/funchand/functions/func-get-args.xml:1.1 phpdoc-fr/reference/funchand/functions/func-get-args.xml:1.2 --- phpdoc-fr/reference/funchand/functions/func-get-args.xml:1.1 Sun Apr 14 20:28:48 2002 +++ phpdoc-fr/reference/funchand/functions/func-get-args.xml Mon Sep 22 09:25:06 2003 @@ -12,7 +12,7 @@ <title>Description</title> <methodsynopsis> <type>array</type><methodname>func_get_args</methodname> - <methodparam><type>void</type><parameter/></methodparam> + <void/> </methodsynopsis> <simpara> <function>func_get_args</function> retourne un tableau dont @@ -22,24 +22,27 @@ alerte si elle est appel&eacute;e hors d'une fonction. </simpara> <para> - <informalexample> + <example> + <title>Exemple avec <function>func_get_args</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function foo() { $numargs = func_num_args(); - echo "Nombre d'arguments: $numargs&lt;br&gt;\n"; - if ($numargs &gt;= 2) { - echo "Le second argument est: " . func_get_arg (1) . "&lt;br&gt;\n"; + echo "Nombre d'arguments: $numargs<BR>\n"; + if ($numargs >= 2) { + echo "Le second argument est : " . func_get_arg (1) . "<BR>\n"; } $arg_list = func_get_args(); - for ($i = 0; $i &lt; $numargs; $i++) { - echo "L'argument $i est: " . $arg_list[$i] . "&lt;br&gt;\n"; + for ($i = 0; $i < $numargs; $i++) { + echo "L'argument $i est : " . $arg_list[$i] . "<BR>\n"; } } foo(1, 2, 3); -?&gt; +?> +]]> </programlisting> - </informalexample> + </example> </para> <simpara> <function>func_get_arg</function> peut &ecirc;tre utilis&eacute; Index: phpdoc-fr/reference/funchand/functions/func-num-args.xml diff -u phpdoc-fr/reference/funchand/functions/func-num-args.xml:1.1 phpdoc-fr/reference/funchand/functions/func-num-args.xml:1.2 --- phpdoc-fr/reference/funchand/functions/func-num-args.xml:1.1 Sun Apr 14 20:28:49 2002 +++ phpdoc-fr/reference/funchand/functions/func-num-args.xml Mon Sep 22 09:25:06 2003 @@ -12,7 +12,7 @@ <title>Description</title> <methodsynopsis> <type>int</type><methodname>func_num_args</methodname> - <methodparam><type>void</type><parameter/></methodparam> + <void/> </methodsynopsis> <simpara> <function>func_num_args</function> retourne le nombre d'arguments @@ -22,17 +22,20 @@ hors d'une fonction. </simpara> <para> - <informalexample> + <example> + <title>Exemple avec <function>func_num_args</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function foo() { $numargs = func_num_args(); echo "Nombre d'arguments: $numargs\n"; } foo (1, 2, 3); // affiche 'Nombre d'arguments: 3' -?&gt; +?> +]]> </programlisting> - </informalexample> + </example> </para> <simpara> <function>func_get_arg</function> peut &ecirc;tre utilis&eacute; Index: phpdoc-fr/reference/funchand/functions/function-exists.xml diff -u phpdoc-fr/reference/funchand/functions/function-exists.xml:1.2 phpdoc-fr/reference/funchand/functions/function-exists.xml:1.3 --- phpdoc-fr/reference/funchand/functions/function-exists.xml:1.2 Tue Aug 13 22:19:32 2002 +++ phpdoc-fr/reference/funchand/functions/function-exists.xml Mon Sep 22 09:25:06 2003 @@ -5,37 +5,40 @@ <refnamediv> <refname>function_exists</refname> <refpurpose> - Indique si une fonction est d&eacute;finie. + Indique si une fonction est d&eacute;finie </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> - <type>boolean</type><methodname>function_exists</methodname> + <type>bool</type><methodname>function_exists</methodname> <methodparam><type>string</type><parameter>function_name</parameter></methodparam> </methodsynopsis> <para> <function>function_exists</function> v&eacute;rifie la liste des - fonctions d&eacute;finies par l'utilisateur, et retourne - &true; si <parameter>function_name</parameter> - y est trouv&eacute;, &false;sinon. - <informalexample> + fonctions d&eacute;finies par l'utilisateur. + &return.success; + <example> + <title>Exemple avec <function>function_exists</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php if (function_exists('imap_open')) { - echo "Les fonctions IMAP sont disponibles.&lt;br&gt;\n"; + echo "Les fonctions IMAP sont disponibles.<BR>\n"; } else { - echo "Les fonctions IMAP ne sont pas disponibles.&lt;br&gt;\n"; + echo "Les fonctions IMAP ne sont pas disponibles.<BR>\n"; } -?&gt; +?> +]]> </programlisting> - </informalexample> + </example> Notez qu'une fonction peut exister, m&ecirc;me si elle est indisponible, &agrave; cause de la configuration ou des options de compilation. </para> <para> Voir aussi - <function>method_exists</function>. + <function>method_exists</function> et + <function>get_defined_functions</function>. </para> </refsect1> </refentry> Index: phpdoc-fr/reference/funchand/functions/get-defined-functions.xml diff -u phpdoc-fr/reference/funchand/functions/get-defined-functions.xml:1.1 phpdoc-fr/reference/funchand/functions/get-defined-functions.xml:1.2 --- phpdoc-fr/reference/funchand/functions/get-defined-functions.xml:1.1 Sun Apr 14 20:28:49 2002 +++ phpdoc-fr/reference/funchand/functions/get-defined-functions.xml Mon Sep 22 09:25:06 2003 @@ -12,7 +12,7 @@ <title>Description</title> <methodsynopsis> <type>array</type><methodname>get_defined_functions</methodname> - <methodparam><type>void</type><parameter/></methodparam> + <void/> </methodsynopsis> <para> <function>get_defined_functions</function> retourne un tableau multi- @@ -21,48 +21,52 @@ d&eacute;finie par l'utilisateur. Les noms des fonctions internes sont accessibles via <varname>$arr["internal"]</varname>, et les fonctions utilisateur sont accessibles via <varname>$arr["user"]</varname>. - <informalexample> + <example> + <title>Exemple avec <function>get_defined_functions</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function maligne($id, $data) { - return "&lt;tr&gt;&lt;th&gt;$id&lt;/th&gt;&lt;td&gt;$data&lt;/td&gt;&lt;/tr&gt;\n"; + return "<tr><th>$id</th><td>$data</td></tr>\n"; } $arr = get_defined_functions(); print_r($arr); -?&gt; +?> +]]> </programlisting> - </informalexample> - </para> <para> Ce script va afficher : - <informalexample> + </para> <programlisting> +<![CDATA[ Array ( - [internal] =&gt; Array + [internal] => Array ( - [0] =&gt; zend_version - [1] =&gt; func_num_args - [2] =&gt; func_get_arg - [3] =&gt; func_get_args - [4] =&gt; strlen - [5] =&gt; strcmp - [6] =&gt; strncmp + [0] => zend_version + [1] => func_num_args + [2] => func_get_arg + [3] => func_get_args + [4] => strlen + [5] => strcmp + [6] => strncmp ... - [750] =&gt; bcscale - [751] =&gt; bccomp + [750] => bcscale + [751] => bccomp ) - [user] =&gt; Array + [user] => Array ( - [0] =&gt; maligne + [0] => maligne ) ) +]]> </programlisting> - </informalexample> + </example> </para> <para> Voir aussi - <function>get_defined_vars</function>. + <function>get_defined_vars</function> et + <function>get_defined_constants</function>. </para> </refsect1> </refentry> Index: phpdoc-fr/reference/funchand/functions/register-shutdown-function.xml diff -u phpdoc-fr/reference/funchand/functions/register-shutdown-function.xml:1.1 phpdoc-fr/reference/funchand/functions/register-shutdown-function.xml:1.2 --- phpdoc-fr/reference/funchand/functions/register-shutdown-function.xml:1.1 Sun Apr 14 20:28:49 2002 +++ phpdoc-fr/reference/funchand/functions/register-shutdown-function.xml Mon Sep 22 09:25:06 2003 @@ -10,23 +10,47 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>int</type><methodname>register_shutdown_function</methodname> - <methodparam><type>string</type><parameter>func</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>void</type><methodname>register_shutdown_function</methodname> + <methodparam><type>callback</type><parameter>function</parameter></methodparam> + </methodsynopsis> <simpara> <function>register_shutdown_function</function> enregistre la fonction <parameter>func</parameter> pour ex&eacute;cution &agrave; l'extinction du script. </simpara> - <para> - Erreur courante : - </para> - <simpara> - Etant donn&eacute; qu'aucun affichage n'est possible depuis la fonction - <parameter>func</parameter>, vous ne pouvez pas y mettre d'informations - de d&eacute;buggage par <function>print</function> ou <function>echo</function>! - </simpara> + <para> + Plusieurs appels &agrave; <function>register_shutdown_function</function> sont + possibles dans le m&ecirc;me script, et les fonctions seront appel&eacute;es dans le + m&ecirc;me ordre que celui dans elles sont enregistr&eacute;es. SI vous appelez + <function>exit</function> durant l'une des fonctions d'extinction, + le processus sera d&eacute;finitivement arr&eacute;t&eacute;, sans que les autres fonctions + soient appel&eacute;es. + </para> + <para> + Les fonctions d'extinction sont appel&eacute;es apr&egrave;s la fin de la requ&ecirc;te + (notamment les buffers ont &eacute;t&eacute; vid&eacute;s), ce qui fait qu'il est impossible + d'afficher du texte depuis cette fonction, avec <function>echo</function> ou + <function>print</function>, ou encore de lire le contenu des buffers + avec <function>ob_get_contents</function>. + </para> + <note> + <para> + Typiquement, les fonctions non d&eacute;finies causent des + erreurs fatales en &php;, mais lorsque la fonction + <parameter>function</parameter> est appel&eacute;e avec + <function>register_shutdown_function</function> en &eacute;tant non d&eacute;finie, + une erreur de type <constant>E_WARNING</constant> est g&eacute;n&eacute;r&eacute;e. De plus, + pour des raisons internes &agrave; &php; cette erreur va &ecirc;tre indiqu&eacute;e + comme <literal>Unknown at line #0</literal>. + </para> + </note> + <para> + Voir aussi + <link linkend="ini.auto-append-file">auto_append_file</link>, + <function>exit</function>, et la section sur la + <link linkend="features.connection-handling">gestion des connexions</link>. + </para> </refsect1> </refentry> Index: phpdoc-fr/reference/funchand/functions/register-tick-function.xml diff -u phpdoc-fr/reference/funchand/functions/register-tick-function.xml:1.1 phpdoc-fr/reference/funchand/functions/register-tick-function.xml:1.2 --- phpdoc-fr/reference/funchand/functions/register-tick-function.xml:1.1 Sun Apr 14 20:28:49 2002 +++ phpdoc-fr/reference/funchand/functions/register-tick-function.xml Mon Sep 22 09:25:06 2003 @@ -10,16 +10,39 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>void</type><methodname>register_tick_function</methodname> - <methodparam><type>string</type><parameter>func</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>void</type><methodname>register_tick_function</methodname> + <methodparam><type>callback</type><parameter>function</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam> + </methodsynopsis> <simpara> <function>register_tick_function</function> enregistre la fonction - <parameter>func</parameter> pour &ecirc;tre ex&eacute;cut&eacute;e &agrave; chaque fois qu'un + <parameter>func</parameter> pour &ecirc;tre ex&eacute;cut&eacute;e + &agrave; chaque fois qu'un <link linkend="control-structures.declare">tick</link> est appel&eacute;. </simpara> + <para> + <example> + <title>Exemple avec <function>register_tick_function</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Utilisation d'une fonction de callback +register_tick_function('ma_function', TRUE); + +// Utilisation d'une m&eacute;thode d'objet +$objet = new ma_classe(); +register_tick_function(array(&$objet, 'ma_methode'), TRUE); +?> +]]> + </programlisting> + </example> + </para> + <para> + Voir aussi + <function>declare</function> et + <function>unregister_tick_function</function>. + </para> </refsect1> </refentry> Index: phpdoc-fr/reference/funchand/functions/unregister-tick-function.xml diff -u phpdoc-fr/reference/funchand/functions/unregister-tick-function.xml:1.1 phpdoc-fr/reference/funchand/functions/unregister-tick-function.xml:1.2 --- phpdoc-fr/reference/funchand/functions/unregister-tick-function.xml:1.1 Sun Apr 14 20:28:49 2002 +++ phpdoc-fr/reference/funchand/functions/unregister-tick-function.xml Mon Sep 22 09:25:06 2003 @@ -10,11 +10,10 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>void</type><methodname>unregister_tick_function</methodname> - <methodparam><type>string</type><parameter>func</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>void</type><methodname>unregister_tick_function</methodname> + <methodparam><type>string</type><parameter>function_name</parameter></methodparam> + </methodsynopsis> <simpara> <function>unregister_tick_function</function> annule l'ex&eacute;cution automatique de <parameter>func</parameter> &agrave; chaque
« previous php.doc.fr (#780) next »