#27639 [Opn->Bgs]: Function Level Constands

From: Date: Thu, 18 Mar 2004 21:08:51 +0000
Subject: #27639 [Opn->Bgs]: Function Level Constands
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-56640@lists.php.net to get a copy of this message
ID: 27639 Updated by: rasmus@php.net Reported By: hallow at webmages dot com -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.3.4 New Comment: You can get this info via debug_backtrace() Previous Comments: ------------------------------------------------------------------------ [2004-03-18 15:41:29] hallow at webmages dot com Description: ------------ In building my own functions, in particular an include work-a-like that does some pre and post processing, it would be very handy to have a __CALLER__ constant that indicates the file the function was called from, and and a __CLINE__ constant or something similar that indicates the line number in the caller where the function was called from. It appears that the only way to accomplish this within PHP by having the function take __FILE__ and __LINE__ as parameters, which for an potentially oft used function makes for a lot of extra typing. Reproduce code: --------------- function my_include(file,caller,line) { echo "Called from: ",$caller,", line number: ", $line; include(file); } my_include(file,__FILE__,__LINE__); could be: function my_include(file) { echo "Called from: ", __CALLER__ , " , line number: ", __CLINE__; include(file); } my_include(file); Expected result: ---------------- Called from: SOMEFILE, line number: SOMEINT ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27639&edit=1

« previous php.bugs (#56640) next »