top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

what is the use for error_log() in php?

0 votes
303 views
what is the use for error_log() in php?
posted Aug 3, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The error_log() function sends an error to the server error log, a file or a remote destination.

This funtion returns TRUE on success, or FALSE on failure.

error_log(error,type,destination,headers)

Example:

<?php
// Send notification through the server log if we can not
// connect to the database.
if (!Ora_Logon($username, $password)) {
    error_log("Oracle database not available!", 0);
}

// Notify administrator by email if we run out of FOO
if (!($foo = allocate_new_foo())) {
    error_log("Big trouble, we're all out of FOOs!", 1,
               "operator@example.com");
}

// another way to call error_log():
error_log("You messed up!", 3, "/var/tmp/my-errors.log");
?>
answer Aug 5, 2014 by Madhavi Latha
Similar Questions
+1 vote

Also, tell me the difference between them.I know about empty() function(It will used to check whether the variable is empty or not).I wonder to know what's the main use for is_null() function.

0 votes

I have a question about using a php user class and session variables. Let's say that I have managed to create a user class that finds a particular person from the database query.

As I move about the site from page to page it would be nice to be able to use the current user inside the user class without needing to re – look them up in the database multiple times

Q: so is there a way to combine the current active user in the class with session variables so that they can be used multiple times? If so, how would this work?

...