Filename and Line Number Custom Error


Posted on 16th Feb 2014 07:03 pm by admin

I have a class, with a method that accepts 2 parameters. I would like to output error messages.

So, lets say a new file is created, and my class is used in that file. We will call that file test.php lets say they use this method with two parameters on line 105 but... they forget to add the second parameter. I currently display this message:

print("<p><b>Warning:</b> Class <b>" . __class__ . "</b> requires 2 parameters, 1 given.</p>");

Warning: Class ClassName requires 2 parameters, 1 given.

I would like to change it to also include the file name and the line number, so the final result would look like this:

Warning: Class ClassName requires 2 parameters, 1 given in /home/user/www/test.php on line 105.

How can I get the file name and line number from within the class? Is it possible?

No comments posted yet

Your Answer:

Login to answer
325 Like 20 Dislike
Previous forums Next forums
Other forums

please help me in this update statment
hi every one

if I have table and this data in it

id name
10

Need PHP help... have all the elements... just need help putting them together :
Hey Guys,

I was wondering if someone could help me. I am doing a website for a client which

Calling variables
I want to call this to my website but it doesn't display what I want it to,

Code: <h5&

Mail functionality from localhost to server
Hi

I am facing problem of mail functionality.

When i tested mail functionality in my

How to store checkbox array in a session, and then be able to add to it?
I'm trying to store an array of checkbox values into a session array, sort of like a shopping cart,

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

php mysql query from input textbox
Hi,

I have a text box, in that i have given the mysql query. I can able to get the query in v

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename

PHP Surveys
I really would like some advice.

If you have a client come to you asking for a survey to be d

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash