Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    557
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Can I get info of which file and line number made a call to my own function?

    Is it possible to get the file and line number where a call was made to a function?

  2. #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,827
    Thanks
    79
    Thanked 575 Times in 562 Posts
    Hello,

    Yes for the current line and file you can use the magic constants __LINE__ and __FILE__.

    For the call stack, you can use debug_backtrace() though you'll want to run that through var_dump(). It will give you an array of arrays with things like function names, line numbers etc.
    Quote Originally Posted by deathshadow View Post
    So seriously, loosen up that tie, let out the belt, and try relating to normal people on the street instead of the gentleman's club crowd.

  3. #3
    Regular Coder
    Join Date
    Oct 2009
    Posts
    557
    Thanks
    10
    Thanked 3 Times in 3 Posts
    ah, thank you for this, I shall look in to it more and see if this can help me.

    Cheers


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •