note 41672 deleted from function.set-error-handler by cmb
| From: | cmb@php.net | Date: | Sun, 25 Aug 2019 09:01:28 +0000 |
| Subject: | note 41672 deleted from function.set-error-handler by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211990@lists.php.net to get a copy of this message | ||
Note Submitter: erwin at isiz dot nl
----
@sijmen at digitized dot nl
That's not true. The reference operator does have effect, when used correctly.
Your code doesn't use the reference operator in the set_error_handler function, but it does
when creating the new error object. In your case, you have to use the reference operator two times.
When calling the set_error_handler function
<?php
set_error_handler(array(&$this, 'handler'));
?>
and when creating the class
<?php
$eh = &new error;
?>
In that case the same error class will be used and the output will be following:
Error!
!!
Hope this helps.