mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
die is just an alias for exit, so document it that way.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@58670 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
71c1619673
commit
a7ab91727a
2 changed files with 26 additions and 72 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<appendix id="aliases">
|
||||
<title>Aliases list</title>
|
||||
<para>
|
||||
|
@ -198,6 +198,11 @@
|
|||
<entry><function>ccvs_void</function></entry>
|
||||
<entry><link linkend="ref.ccvs">CCVS</link></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>die</entry>
|
||||
<entry><function>exit</function></entry>
|
||||
<entry><link linkend="ref.misc">Miscellaneous functions</link></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>dir</entry>
|
||||
<entry><function>getdir</function></entry>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.55 $ -->
|
||||
<!-- $Revision: 1.56 $ -->
|
||||
<reference id="ref.misc">
|
||||
<title>Miscellaneous functions</title>
|
||||
<titleabbrev>Misc.</titleabbrev>
|
||||
|
@ -239,72 +239,6 @@ if (defined("CONSTANT")){ // Note that it should be quoted
|
|||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.die">
|
||||
<refnamediv>
|
||||
<refname>die</refname>
|
||||
<refpurpose>
|
||||
Output a message and terminate the current script
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>void <function>die</function></funcdef>
|
||||
<paramdef>string <parameter>message</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<simpara>
|
||||
<function>die</function> outputs <parameter>message</parameter>
|
||||
and terminates parsing of the script. It does not return
|
||||
anything.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Alternatively, <function>die</function> will also accept a
|
||||
function as a parameter. That function will be executed
|
||||
before <function>die</function> terminates parsing of the script.
|
||||
</simpara>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>die</function> example</title>
|
||||
<programlisting role="php">
|
||||
<?php
|
||||
|
||||
$filename = '/path/to/data-file';
|
||||
$file = fopen ($filename, 'r')
|
||||
or die("unable to open file ($filename)");
|
||||
|
||||
?>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>die</function> example using a function</title>
|
||||
<programlisting role="php">
|
||||
<?php
|
||||
|
||||
function handle_error($msg) {
|
||||
if ($fp = @fopen("/tmp/error.log", "a")) {
|
||||
fwrite($fp, $msg, strlen($msg));
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
if ($bad) {
|
||||
die(handle_error("Something bad happened.\n"));
|
||||
}
|
||||
|
||||
?>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>exit</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.eval">
|
||||
<refnamediv>
|
||||
<refname>eval</refname>
|
||||
|
@ -375,24 +309,39 @@ This is a cup with my coffee in it.
|
|||
<refentry id="function.exit">
|
||||
<refnamediv>
|
||||
<refname>exit</refname>
|
||||
<refpurpose>Terminate current script</refpurpose>
|
||||
<refpurpose>Output a message and terminate the current script</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>void <function>exit</function></funcdef>
|
||||
<paramdef>mixed <parameter>status</parameter></paramdef>
|
||||
<paramdef>mixed <parameter><optional>status</optional></parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<simpara>
|
||||
The <function>exit</function> function terminates execution of
|
||||
the script. It has no return value, but will use
|
||||
<parameter>status</parameter> as its exit status.
|
||||
<parameter>status</parameter> as its exit status, as well as
|
||||
printing it.
|
||||
</simpara>
|
||||
<simpara>
|
||||
See also <function>die</function>.
|
||||
Also aliased as <function>die</function>.
|
||||
</simpara>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>exit</function> example</title>
|
||||
<programlisting role="php">
|
||||
<?php
|
||||
|
||||
$filename = '/path/to/data-file';
|
||||
$file = fopen ($filename, 'r')
|
||||
or exit("unable to open file ($filename)");
|
||||
|
||||
?>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue