Pitfall of Defining Constants
The PHP define statement is really handy. I've used it to define all kind of constants. But recently I stumbled across a pitfall when I defined a constant name two different ways different if clauses. In the true clause, I defined it one way, while defining it another way in the false clause. The constant never changes. Two things I learned from this exercise.
Knowing these constraints, I started developing my software more carefully, using scoped class variables, rather than using constants all the time. You might end up stepping on yourself quite often if you keep defining global constants.
Did your message disappear? Read the Forums FAQ.
Spam Control | * indicates required field
TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.
No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.
Messages, files, and images copyright by respective owners.
29 Users Online
Copyright © 1996 - 2019. All Rights Reserved.