Doc #80191 [Opn->Csd]: Deprecated example
Edit report at https://bugs.php.net/bug.php?id=80191&edit=1
ID: 80191
Updated by: phpdocbot@php.net
Reported by: Kreweta0 at op dot pl
Summary: Deprecated example
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: *General Issues
Operating System: n/a
PHP Version: 7.4.11
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=3e0354fcfc15160a9cfae43f56966f0fbcbc5cd9
Log: Fix #80191: Deprecated example
Previous Comments:
------------------------------------------------------------------------
[2020-10-06 11:21:52] Kreweta0 at op dot pl
Description:
------------
In the PHP manual on page https://www.php.net/manual/en/language.operators.errorcontrol.php
the first example has an expression that uses the $php_errormsg variable, as shown below.
$my_file = @file ('non_existent_file') or
die ("Failed opening file: error was '$php_errormsg'");
The manual does say that this $php_errormsg variable is set only if "track_errors" feature
is enabled. However, I found out that it is actually a deprecated feature now. I was slightly
confused when I got an error -- Undefined variable: php_errormsg -- when the example teaches me how
to ignore errors.
I think that another example might serve as a better introduction to the '@' operator,
while this existing one can be shown later as a relic of the past the reader might see around.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80191&edit=1
Thread (2 messages)