otuatail Posted November 24, 2011 Share Posted November 24, 2011 I have at the very top of my web page the following. Not inside any function in case that would have a scope issue. Define ('GROUP', '1'); Define ('ROUNDOF16', '2'); Define ('QUARTERFINAL', '3'); Define ('SEMIFINAL', '4'); Define ('FINAL', '5'); Lower down I have if($Round == 5) This works but this if($Round == FINAL) has error Parse error: syntax error, unexpected T_FINAL in ....... I thought this was correct ! Quote Link to comment https://forums.phpfreaks.com/topic/251725-using-define/ Share on other sites More sharing options...
jcbones Posted November 24, 2011 Share Posted November 24, 2011 The problem is NOT the DEFINE (CONSTANT), it is the Name of it. FINAL was introduced in PHP5 to keep a child classes from overriding a method. Explained here. Quote Link to comment https://forums.phpfreaks.com/topic/251725-using-define/#findComment-1290939 Share on other sites More sharing options...
Adam Posted November 24, 2011 Share Posted November 24, 2011 It's good practise to add a prefix to your constants, to prevent such ambiguity. Quote Link to comment https://forums.phpfreaks.com/topic/251725-using-define/#findComment-1290940 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.