![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| "The Plankmeister" <plankmeister_NO_@_SPAM_hotmail.com> wrote in message news:<3f3cffe6$0$24637$edfadb0f@dread14.news.tele. dk>... > > I have a class, in which I want to declare some constants. Bad idea. Every instance of the class will then attempt to define the same set of constants, producing errors... > However... when I try and define a constant in a class, I then get the > following error: Fatal error: Cannot instantiate non-existent class: > global_settings in C:\Inetpub\wwwroot\main.php on line 13 Can you please post some of your code? Cheers, NC | |||
| Advertisements |
| | #2 | ||
| Nikolai Chuvakhin wrote: > "The Plankmeister" <plankmeister_NO_@_SPAM_hotmail.com> wrote > in message news:<3f3cffe6$0$24637$edfadb0f@dread14.news.tele. dk>... > >>I have a class, in which I want to declare some constants. > > > Bad idea. Every instance of the class will then attempt to > define the same set of constants, producing errors... Is this true? You can't _re-define_ constants but it wont produce an error if you attempt it (it just wont work). Or am I wrong? >>However... when I try and define a constant in a class, I then get the >>following error: Fatal error: Cannot instantiate non-existent class: >>global_settings in C:\Inetpub\wwwroot\main.php on line 13 > > > Can you please post some of your code? > > Cheers, > NC -- MeerKat | |||
| | #3 | ||
| MeerKat wrote: producing errors... > > Is this true? You can't _re-define_ constants but it wont produce an > error if you attempt it (it just wont work). Or am I wrong? > It porbably will if you have error_reporting(E_ALL) set... What's wrong with putting the defines in global scope in the class source code? Presumably, the whole point of the constants is that they can be used by the code using the class, so it wouldn't make sense to hide them inside the object's scope... What exactly are you trying to achieve? Might make it easier to see what's happening! Matt | |||
| | #4 | ||
| matty wrote: > MeerKat wrote: > > producing errors... > >>Is this true? You can't _re-define_ constants but it wont produce an >>error if you attempt it (it just wont work). Or am I wrong? >> > > > It porbably will if you have error_reporting(E_ALL) set... Yup. Dead right. > What's wrong with putting the defines in global scope in the class source > code? Presumably, the whole point of the constants is that they can be > used by the code using the class, so it wouldn't make sense to hide them > inside the object's scope... > > What exactly are you trying to achieve? Might make it easier to see > what's happening! > > Matt -- MeerKat | |||
| Featured Websites | ||||
|
![]() |
| Tags: classes, constants, defining |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help needed on explaining a bit about Classes and HTML forms | Warstar | PHP | 3 | 07-01-2007 5:07 PM |
| classes... why? | Sticks | PHP | 11 | 07-01-2007 5:06 PM |
| Featured Websites | ||||
|