Page 1 of 1

Naming a class with a variable/constant ... possible?

Posted: Sun Feb 03, 2008 1:12 am
by hamr23
:oops: Hello everyone, first post here...

I don't know if it's a stupid question... I have searched for it and didn't find any answer...

I want to have a constant defined in my globals file, so I can add a prefix to all the defined classes in my app... I'm pretty sure it isn't best practice, but I'm just curious...

Thanks for your time!

Re: Naming a class with a variable/constant ... possible?

Posted: Sun Feb 03, 2008 1:18 am
by Chris Corbyn
Not possible sorry. You can use eval() but the overhead would make it pointless. Namespacing using the name of your library/application/project has worked well for years, I'd stick with that ;)

Re: Naming a class with a variable/constant ... possible?

Posted: Sun Feb 03, 2008 1:21 am
by hamr23
Yeah, I expected that answer... I don't know... maybe it's time for me to stop drinking coffee... LoL

Thanks !!

Re: Naming a class with a variable/constant ... possible?

Posted: Sun Feb 03, 2008 7:19 pm
by Jonah Bron
Or cut down? :D

Oh, and welcome to the PHPDN! (also known as the DevNet)