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

php and downloading
I want to use a php script to create two files. Then I want it to redirect (or whatever) to have tho

Making multiple rows with one query
I have a table called efed_handler_characters with two fields handler_id and bio_id. What query 2 is

HTAccess auto log in?
Hi all.

Too busy driving celebs about lately so I hope someone here can help me out.

I

ScriptManager History and Opera Issue
I am having an issue in opera with the ScriptManager. I have a ScriptManager on a page with history

Find only certain URLs from page ... regex (semi-complete script)
Hi guys,

What I need to do is take a page & extract all the URLs from the page &a

Multi Dimensional Array Append
Hi Guys

I have a function that returns a multidimentional array eg

$result = functio

How to insert random unique values in 2 columns ?
I have table with 2 columns

Create Table code_for_code (
first_code varchar2(10) uni

Array disappearing in foreach loop
Okay, I have this problem where an array will become undefined in a foreach loop.

Here is the

Just cannot get 'area' to submit to db using same php code as already used
Basically all i have done is just modified some code and added an area section.
The form is allre

Perplexing problem showing a .jpg
Please disregard..........I figured it out

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