SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2002
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Does php have some kind of statement which gives you the file line it's called from?

    I'm working on a pretty big OO project and I've run into an excrutiatingly annoying problem where a function is being called more times then it should be but I can't figure out where it's being called from.

    If there was some mechanism by which the function would print out the line of the file it's being called from that would enable me to pinpoint the problem pretty easily.

    If php can't do this... well.. I have tough times ahead of me. One module out of about 15 which has no obvious unique characteristics always causes an extra call to my module loading function.

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2002
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Five minutes after posting this topic I solved my problem. It would still be nice to know whether php has a mechanism for getting the current line of the file being interpreted though.

  3. #3
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would debug_backtrace do the job?
    Oh no! the coots are eating my nodes!

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Gold Coast, AU
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    __LINE__ 
    PHP Code:
    __FILE__ 
    Always remember to pillage, before you burn!


Bookmarks

Posting Permissions

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