That's because you're apparently using it outside any functions. If you try it inside a function, you will definitely need the global definition.
Also, don't forget the FILE constant, which not only gives the full local pathname (sometime this is better, sometimes not) but unlike $PHP_SELF gives the actual name of include-files. Yes, PHP has LINE also (love that C heritage!)