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

  • Home
  • SEARCH
  • 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 6875275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:18:06+00:00 2026-05-27T04:18:06+00:00

I have a constant like define(EMPLOYEE_NAME_ID,employee); and a variable $code = EMPLOYEE; now i

  • 0

I have a constant like define(“EMPLOYEE_NAME_ID”,”employee”); and a variable $code = EMPLOYEE;

now i want to print like below

<?php echo $code.NAME_ID; ?>

But this prints only “EMPLOYEE_NAME_ID” and i want to print “employee”. Then how to print this. The all over means is that i want to retriew variables from lang 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-05-27T04:18:07+00:00Added an answer on May 27, 2026 at 4:18 am

    A unquote string in PHP will be parsed as constant,
    and if the constant is undefined,
    it will treat as the string (instead of a variable)

    If you dealing with constant, you can make use of constant function :-

    echo constant("{$code}_NAME_ID");
    

    However, use of this function will return warning message if the constant is not defined.
    There are other option like parse_ini_file you can take a look,
    this is ideal for handling large amount of setting / configuration

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write something like Skype, i.e. I have a constant audio stream
I want to force subclasses to define a constant value. Like const string SomeConstantEverySubclassMustDefine
So I have something like this #define HASHSIZE 1010081 static struct nlist *hashtab[HASHSIZE]; Now
I have defined a few constants like this: define(TITLE_2,Yahoo); define(TITLE_3,Google); Next, I want to
I have several constant defined for a webservice, and I would like to make
Let's say I have a hashref constant like the following: use constant DOGS =>
I've noticed many (all?) PHP constants have a single-letter prefix, like E_NOTICE , T_STRING
I have code that looks like: //System.Data.IDataRecord dr try { Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false);
Suppose I have a constant defined in a header file #define THIS_CONST 'A' I
I have an std::map , and I would like to define an iterator that

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.