jeroen Wed May 23 16:43:13 2001 EDT
Modified files:
/phpdoc/en/language operators.xml
Log:
Fixed example, added note that @foreach doesn't work,
added note that db-functions usually don't cause
a php error, and finally added an example
to show that its use isn't restricted to
functions
Index: phpdoc/en/language/operators.xml
diff -u phpdoc/en/language/operators.xml:1.17 phpdoc/en/language/operators.xml:1.18
--- phpdoc/en/language/operators.xml:1.17 Mon Jan 22 18:50:39 2001
+++ phpdoc/en/language/operators.xml Wed May 23 16:43:12 2001
@@ -267,12 +267,29 @@
<programlisting role="php">
<?php
/* Intentional SQL error (extra quote): */
-$res = @mysql_query ("select name, code from 'namelist") or
- die ("Query failed: error was '$php_errormsg'");
+$my_file = @file ('non_esistent_file') or
+ die ("Failed opening file: error was '$php_errormsg'");
+
+// this works for any expression, not just functions:
+$value = @$cache[$key];
+// will not issue a notication if the index $key doesn't exist.
+
?>
</programlisting>
</informalexample>
</para>
+ <note>
+ <simpara>
+ The @-operator doesn't work with foreach.
+ </simpara>
+ </note>
+ <note>
+ <simpara>
+ Most database-functions do not return PHP-errors, rather,
+ you must use some get_error() function applicable for
+ your database type.
+ </simpara>
+ </note>
<simpara>
See also <function>error_reporting</function>.
</simpara>