Forum Moderators: coopster

Message Too Old, No Replies

Preprocessor directives in PHP

#define like C?

         

aspr1n

11:57 pm on May 9, 2003 (gmt 0)

10+ Year Member



Hi all,

Anyone know if there is a way in PHP to create C like preprocessor directives in PHP eg: #define VALUE 2

I don't want to use constants as I have no need to evaluate them each time and so is a waste as they're purely there for code readability.

Cheers,

asp

ShawnR

1:33 am on May 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Its an interpretted scripting language so they'd be 'evaluated' (in a manner of speaking) anyway ...

DrDoc

1:39 am on May 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In other words: No

In C (and to some extent even in Perl) you have to do everything manually. In PHP, it's pretty much taken care of, and there's nothing much you can do/change about it...

daisho

1:46 am on May 10, 2003 (gmt 0)

10+ Year Member



I've looked into it and there is no direct replacement. You may want to look at the "eval" function in PHP.

daisho