0

I have the following underfined constant error:

test.php:

Notice: Use of undefined constant APP_ID - assumed 'APP_ID' in 
/var/www/_calls/config.php on line 3 

Relevant lines of code:

test.php:

require_once('config.php');

config.php:

define(APP_ID, 'Your app name');
1
  • 1
    When you decided which lines you think are relevant, you did so while making the same mistake you made when writing the code, which has caused the bug. Consequently, we can't see here what you did wrong. Construct and display your testcase so we can see what's really going on. (edit: you're in luck: the bug is right here after all. You should still learn to make testcases!) Commented Jan 11, 2014 at 16:52

2 Answers 2

3

You define constants with a string. You cannot use the constant to define the constant because the constant is not yet defined:

define('APP_ID', 'Your app name');

It's only after you've defined the constant that you can refer to it as APP_ID instead of 'APP_ID'.

See define, which accepts string $name , mixed $value...

Sign up to request clarification or add additional context in comments.

Comments

1

Use this

 define('APP_ID', 'Your app name');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.