Reply to name of the calling function

Your name:

Reply:


Posted by Anze on 09/21/05 12:39

Hi all!

Is it possible (in PHP4 and PHP5) to get the filename and line number of the
call to the current function? I need it for debugging purposes:

function query_DB($sql) {
... // do a query here

if ($query_failed)
write_to_log($fail_reason."; Called from ".$__CALLING_FILE__.
" line: ".__CALLING_LINE__);

... // return result
}

__FILE__ and __LINE__ are not good enough - they will always return the
address of query_DB() function, but I need the address where the function
was called (this is where the error comes from).

Any idea if this can be done?

Kind regards,

Anze

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация