Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8314993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:00:37+00:00 2026-06-08T21:00:37+00:00

The manual entry for constant() says that if the constant is not defined the

  • 0

The manual entry for constant() says that if the constant is not defined the function should return NULL. In the case of the code below, however, it gives a fatal error.

$constant = get_class($this) . '::' . $name;
$value = constant($constant);

If $name is valid, things work fine. If it’s not, however, I get a fatal error “Undefined class constant …” The manual says it should raise an E_WARNING error too but I’m not seeing this in the log file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:00:39+00:00Added an answer on June 8, 2026 at 9:00 pm

    Your PHP setup may be setup to treat all errors as fatal errors. If that is the case, checking to see if the constant exists before you try to retrieve it will be a fix:

    $constant = get_class($this) . '::' . $name;
    $value = defined($constant) ? constant($constant) : null;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://php.net/manual/en/function.trim.php The manual entry does say that I can remove any specified leading or
The manual does not answer this question : it says the name of the
When I use `man fcntl' got the message: No manual entry for fcntl which
In manual it said that InnoDB has row-level locking, so why if I select
According to PHP.net manual, pg_pconnect will create a persistent connection, or will return the
Recently the PHP manual started showing the following warning on every mysql function page:
I have a date picker but i m trying the manual entry from user
I want to choose an entry from my database randomly, but not on every
I'm trying to use an Entry field to get manual input, and then work
The default ExtJS form.field.date allows manual entry/editing of a date in addition to using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.