Fixed typos in parameter name: trigger_error, user_error

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@31215 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jesus M. Castagnetto 2000-08-25 18:52:24 +00:00
parent 67e3b00211
commit fd99113abd

View file

@ -60,7 +60,7 @@ echo $newfunc(2,M_E)."\n";
<programlisting role="php">
function process($var1, $var2, $farr) {
for ($f=0; $f &lt; count($farr); $f++)
echo $farr[$f]($var1,$var2)."\n";
echo $farr[$f]($var1,$var2)."\n";
}
// create a bunch of math functions
@ -82,7 +82,7 @@ process(2.3445, M_PI, $farr);
// now make a bunch of string processing functions
$garr = array(
create_function('$b,$a','if (strncmp($a,$b,3) == 0) return "** \"$a\" '.
'and \"$b\"\n** Look the same to me! (looking at the first 3 chars)";'),
'and \"$b\"\n** Look the same to me! (looking at the first 3 chars)";'),
create_function('$a,$b','; return "CRCs: ".crc32($a)." , ".crc32(b);'),
create_function('$a,$b','; return "similar(a,b) = ".similar_text($a,$b,&$p)."($p%)";')
);
@ -120,10 +120,10 @@ print_r($av); // for PHP3 use var_dump()
// outputs:
// Array
// (
// [0] =&gt; the mango
// [1] =&gt; a mango
// [2] =&gt; that mango
// [3] =&gt; this mango
// [0] =&gt; the mango
// [1] =&gt; a mango
// [2] =&gt; that mango
// [3] =&gt; this mango
// )
// an array of strings ordered from shorter to longer
@ -132,10 +132,10 @@ print_r($sv);
// outputs:
// Array
// (
// [0] =&gt; small
// [1] =&gt; larger
// [2] =&gt; a big string
// [3] =&gt; it is a string thing
// [0] =&gt; small
// [1] =&gt; larger
// [2] =&gt; a big string
// [3] =&gt; it is a string thing
// )
// sort it from longer to shorter
@ -144,10 +144,10 @@ print_r($sv);
// outputs:
// Array
// (
// [0] =&gt; it is a string thing
// [1] =&gt; a big string
// [2] =&gt; larger
// [3] =&gt; small
// [0] =&gt; it is a string thing
// [1] =&gt; a big string
// [2] =&gt; larger
// [3] =&gt; small
// )
</programlisting>
</example>
@ -213,7 +213,7 @@ print_r($sv);
</funcprototype>
</funcsynopsis>
<simpara>
Returns true if script timed out. See the <link
Returns true if script timed out. See the <link
linkend="features.connection-handling">Connection Handling</link>
description in the <link linkend="features">Features</link>
chapter for a complete explanation.
@ -443,7 +443,7 @@ This is a cup with my coffee in it.
</funcprototype>
</funcsynopsis>
<simpara>
This language construct terminates parsing of the script. It
This language construct terminates parsing of the script. It
does not return.
</simpara>
<simpara>
@ -485,7 +485,7 @@ function foo() {
$numargs = func_num_args();
echo "Number of arguments: $numargs&lt;br&gt;\n";
if ($numargs &gt;= 2) {
echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n";
echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n";
}
}
@ -537,11 +537,11 @@ function foo() {
$numargs = func_num_args();
echo "Number of arguments: $numargs&lt;br&gt;\n";
if ($numargs &gt;= 2) {
echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n";
echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n";
}
$arg_list = func_get_args();
for ($i = 0; $i &lt; $numargs; $i++) {
echo "Argument $i is: " . $arg_list[$i] . "&lt;br&gt;\n";
echo "Argument $i is: " . $arg_list[$i] . "&lt;br&gt;\n";
}
}
@ -594,7 +594,7 @@ function foo() {
echo "Number of arguments: $numargs\n";
}
foo (1, 2, 3); // Prints 'Number of arguments: 3'
foo (1, 2, 3); // Prints 'Number of arguments: 3'
?&gt;
</programlisting>
</informalexample>
@ -684,7 +684,7 @@ foo (1, 2, 3); // Prints 'Number of arguments: 3'
&lt;?php
function list_array ($array) {
while (list ($key, $value) = each ($array)) {
$str .= "&lt;b&gt;$key:&lt;/b&gt; $value&lt;br&gt;\n";
$str .= "&lt;b&gt;$key:&lt;/b&gt; $value&lt;br&gt;\n";
}
return $str;
}
@ -787,14 +787,14 @@ Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)&lt;hr&gt;
&lt;?php
$script = getenv (&quot;PATH_TRANSLATED&quot;);
if(!$script) {
echo &quot;&lt;BR&gt;&lt;B&gt;ERROR: Script Name needed&lt;/B&gt;&lt;BR&gt;&quot;;
echo &quot;&lt;BR&gt;&lt;B&gt;ERROR: Script Name needed&lt;/B&gt;&lt;BR&gt;&quot;;
} else {
if (ereg(&quot;(\.php|\.inc)$&quot;,$script)) {
echo &quot;&lt;H1&gt;Source of: $PATH_INFO&lt;/H1&gt;\n&lt;HR&gt;\n&quot;;
highlight_file($script);
} else {
echo &quot;&lt;H1&gt;ERROR: Only PHP or include script names are allowed&lt;/H1&gt;&quot;;
}
if (ereg(&quot;(\.php|\.inc)$&quot;,$script)) {
echo &quot;&lt;H1&gt;Source of: $PATH_INFO&lt;/H1&gt;\n&lt;HR&gt;\n&quot;;
highlight_file($script);
} else {
echo &quot;&lt;H1&gt;ERROR: Only PHP or include script names are allowed&lt;/H1&gt;&quot;;
}
}
echo &quot;&lt;HR&gt;Processed: &quot;.date(&quot;Y/M/d H:i:s&quot;,time());
?&gt;
@ -962,107 +962,107 @@ http://your.server.com/source/path/to/script.php
<itemizedlist>
<listitem>
<simpara>
a NUL-padded string
a NUL-padded string
</simpara>
</listitem>
<listitem>
<simpara>
A SPACE-padded string
A SPACE-padded string
</simpara>
</listitem>
<listitem>
<simpara>
h Hex string, low nibble first
h Hex string, low nibble first
</simpara>
</listitem>
<listitem>
<simpara>
H Hex string, high nibble first
H Hex string, high nibble first
</simpara>
</listitem>
<listitem>
<simpara>
c signed char
c signed char
</simpara>
</listitem>
<listitem>
<simpara>
C unsigned char
C unsigned char
</simpara>
</listitem>
<listitem>
<simpara>
s signed short (always 16 bit, machine byte order)
s signed short (always 16 bit, machine byte order)
</simpara>
</listitem>
<listitem>
<simpara>
S unsigned short (always 16 bit, machine byte order)
S unsigned short (always 16 bit, machine byte order)
</simpara>
</listitem>
<listitem>
<simpara>
n unsigned short (always 16 bit, big endian byte order)
n unsigned short (always 16 bit, big endian byte order)
</simpara>
</listitem>
<listitem>
<simpara>
v unsigned short (always 16 bit, little endian byte order)
v unsigned short (always 16 bit, little endian byte order)
</simpara>
</listitem>
<listitem>
<simpara>
i signed integer (machine dependent size and byte order)
i signed integer (machine dependent size and byte order)
</simpara>
</listitem>
<listitem>
<simpara>
I unsigned integer (machine dependent size and byte order)
I unsigned integer (machine dependent size and byte order)
</simpara>
</listitem>
<listitem>
<simpara>
l signed long (always 32 bit, machine byte order)
l signed long (always 32 bit, machine byte order)
</simpara>
</listitem>
<listitem>
<simpara>
L unsigned long (always 32 bit, machine byte order)
L unsigned long (always 32 bit, machine byte order)
</simpara>
</listitem>
<listitem>
<simpara>
N unsigned long (always 32 bit, big endian byte order)
N unsigned long (always 32 bit, big endian byte order)
</simpara>
</listitem>
<listitem>
<simpara>
V unsigned long (always 32 bit, little endian byte order)
V unsigned long (always 32 bit, little endian byte order)
</simpara>
</listitem>
<listitem>
<simpara>
f float (machine dependent size and representation)
f float (machine dependent size and representation)
</simpara>
</listitem>
<listitem>
<simpara>
d double (machine dependent size and representation)
d double (machine dependent size and representation)
</simpara>
</listitem>
<listitem>
<simpara>
x NUL byte
x NUL byte
</simpara>
</listitem>
<listitem>
<simpara>
X Back up one byte
X Back up one byte
</simpara>
</listitem>
<listitem>
<simpara>
@ NUL-fill to absolute position
@ NUL-fill to absolute position
</simpara>
</listitem>
</itemizedlist>
@ -1177,7 +1177,7 @@ $binarydata = pack ("nvc*", 0x1234, 0x5678, 65, 66);
</simpara>
<simpara>
To make the serialized string into a PHP value again, use
<function>unserialize</function>. <function>Serialize</function>
<function>unserialize</function>. <function>Serialize</function>
handles the types <type>integer</type>, <type>double</type>,
<type>string</type>, <type>array</type> (multidimensional) and
<type>object</type> (object properties will be serialized, but
@ -1193,13 +1193,13 @@ $binarydata = pack ("nvc*", 0x1234, 0x5678, 65, 66);
$conn = odbc_connect ("webdb", "php", "chicken");
$stmt = odbc_prepare ($conn,
"UPDATE sessions SET data = ? WHERE id = ?");
"UPDATE sessions SET data = ? WHERE id = ?");
$sqldata = array (serialize($session_data), $PHP_AUTH_USER);
if (!odbc_execute ($stmt, &amp;$sqldata)) {
$stmt = odbc_prepare($conn,
"INSERT INTO sessions (id, data) VALUES(?, ?)");
"INSERT INTO sessions (id, data) VALUES(?, ?)");
if (!odbc_execute($stmt, &amp;$sqldata)) {
/* Something went wrong. Bitch, whine and moan. */
/* Something went wrong. Bitch, whine and moan. */
}
}
</programlisting>
@ -1256,39 +1256,39 @@ error_reporting(FATAL + ERROR + WARNING);
// error handler function
function myErrorHandler ($errno, $errstr) {
switch ($errno) {
case FATAL:
echo &quot;&lt;b&gt;FATAL&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
echo &quot; Fatal error in line &quot;.__LINE__.&quot; of file &quot;.__FILE__;
echo &quot;, PHP &quot;.PHP_VERSION.&quot; (&quot;.PHP_OS.&quot;)&lt;br&gt;\n&quot;;
echo &quot;Aborting...&lt;br&gt;\n&quot;;
exit -1;
break;
case ERROR:
echo &quot;&lt;b&gt;ERROR&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
break;
case WARNING:
echo &quot;&lt;b&gt;WARNING&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
break;
default:
echo &quot;Unkown error type: [$errno] $errstr&lt;br&gt;\n&quot;;
break;
case FATAL:
echo &quot;&lt;b&gt;FATAL&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
echo &quot; Fatal error in line &quot;.__LINE__.&quot; of file &quot;.__FILE__;
echo &quot;, PHP &quot;.PHP_VERSION.&quot; (&quot;.PHP_OS.&quot;)&lt;br&gt;\n&quot;;
echo &quot;Aborting...&lt;br&gt;\n&quot;;
exit -1;
break;
case ERROR:
echo &quot;&lt;b&gt;ERROR&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
break;
case WARNING:
echo &quot;&lt;b&gt;WARNING&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
break;
default:
echo &quot;Unkown error type: [$errno] $errstr&lt;br&gt;\n&quot;;
break;
}
}
// function to test the error handling
function scale_by_log ($vect, $scale) {
if ( !is_numeric($scale) || $scale &lt;= 0 )
trigger_error(&quot;log(x) for x &lt;= 0 is undefined, you used: scale = $scale&quot;,
FATAL);
trigger_error(&quot;log(x) for x &lt;= 0 is undefined, you used: scale = $scale&quot;,
FATAL);
if (!is_array($vect)) {
trigger_error(&quot;Incorrect input vector, array of values expected&quot;, ERROR);
return null;
trigger_error(&quot;Incorrect input vector, array of values expected&quot;, ERROR);
return null;
}
for ($i=0; $i&lt;count($vect); $i++) {
if (!is_numeric($vect[$i]))
trigger_error(&quot;Value at position $i is not a number, using 0 (zero)&quot;,
WARNING);
$temp[$i] = log($scale) * $vect[$i];
if (!is_numeric($vect[$i]))
trigger_error(&quot;Value at position $i is not a number, using 0 (zero)&quot;,
WARNING);
$temp[$i] = log($scale) * $vect[$i];
}
return $temp;
}
@ -1398,7 +1398,7 @@ Aborting...&lt;br&gt;
<funcsynopsis>
<funcprototype>
<funcdef>void <function>trigger_error</function></funcdef>
<paramdef>string <parameter>erro_rmsg</parameter></paramdef>
<paramdef>string <parameter>error_msg</parameter></paramdef>
<paramdef>int
<parameter><optional>error_type</optional></parameter>
</paramdef>
@ -1453,7 +1453,7 @@ if (assert($divisor == 0))
based on the current time in microseconds. The prefix can be
useful for instance if you generate identifiers simultaneously on
several hosts that might happen to generate the identifier at the
same microsecond. <parameter>Prefix</parameter> can be up to 114
same microsecond. <parameter>Prefix</parameter> can be up to 114
characters long.
</simpara>
<simpara>
@ -1568,7 +1568,7 @@ $array = unpack ("c2chars/nint", $binarydata);
<title><function>Unserialize</function> example</title>
<programlisting role="php">
// Here, we use unserialize() to load session data from a database
// into $session_data. This example complements the one described
// into $session_data. This example complements the one described
// with <function>serialize</function>.
$conn = odbc_connect ("webdb", "php", "chicken");
@ -1581,8 +1581,8 @@ if (!odbc_execute ($stmt, &amp;$sqldata) || !odbc_fetch_into ($stmt, &amp;$tmp))
// we should now have the serialized data in $tmp[0].
$session_data = unserialize ($tmp[0]);
if (!is_array ($session_data)) {
// something went wrong, initialize to empty array
$session_data = array();
// something went wrong, initialize to empty array
$session_data = array();
}
}
</programlisting>
@ -1603,7 +1603,7 @@ if (!odbc_execute ($stmt, &amp;$sqldata) || !odbc_fetch_into ($stmt, &amp;$tmp))
<funcsynopsis>
<funcprototype>
<funcdef>void <function>user_error</function></funcdef>
<paramdef>string <parameter>erro_rmsg</parameter></paramdef>
<paramdef>string <parameter>error_msg</parameter></paramdef>
<paramdef>int
<parameter><optional>error_type</optional></parameter>
</paramdef>