PHPverse 2025

Voting

: five minus four?
(Example: nine)

The Note You're Voting On

louis at louisworks dot de
6 years ago
Dont forget to put the name of your constant into single quotation mark. You will not get an error or a warning.

<?php
define
("AMOUNT_OF_APPLES", 12);
if(
defined(AMOUNT_OF_APPLES)){
//you won't get an output here
echo AMOUNT_OF_APPLES;
}
?>

so do instead

<?php
define
("AMOUNT_OF_APPLES", 12);
if(
defined("AMOUNT_OF_APPLES")){
//here you go
echo AMOUNT_OF_APPLES;
}

//output: 12
?>

It took me half an day to see it...

<< Back to user notes page

To Top