Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

[PHP3] global variable $php_errormsg From: MEGRET Arnaud (arnaud.megret <email protected>)
Date: 05/15/00

Hi,

I enable the track_errors in php.ini in order to get error messages in the
variable php_errormsg.
It is said in the documentation that it is a GLOBAL variable.
But I cannot access it in a called function :

<?php
function foo()
{
        global $php_errormsg;
        print("Error message in foo is $php_errormsg");
}

function calling()

{

global $php_errormsg;

bad_function(); // Bad PHP function that returns an error message

print("Error message before foo is $php_errormsg");
foo();
print("Error message after foo is $php_errormsg");
}

calling();
?>

I 've got :

Error message before foo is EXPLANATION OF THE ERROR
Error message in foo is
Error message after foo is EXPLANATION OF THE ERROR

any help will be welcome.
PS : I know that I could pass my variable as a parameter of foo() but as
my function foo is a generic log function
I prefer not doing such thing.

____________________________________

Arnaud Megret (arnaud.megret <email protected>)
Cegetel
____________________________________________

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>