Posts: 117
Threads: 30
Joined: Jul 2012
Is there a difference how to write and which option is best
1.
PHP код:
#undef MAX_PLAYERS
const MAX_PLAYERS = 10;
2.
PHP код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 10
Posts: 639
Threads: 92
Joined: Jul 2011
Reputation:
0
Personally I would prefer the second, because I'm most familiar with it. I think most people are more familiar with the second;l however I believe it is a matter of opinion.
Posts: 2,364
Threads: 135
Joined: Dec 2009
Reputation:
0
const is a modifier, it must go with new or another variable declarator.
Can be used as a define that can hold an array
Posts: 295
Threads: 6
Joined: Apr 2013
Reputation:
0
const tells the compiler that this is unchangeable, #define changes all instances at compilation