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 8945145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:11:01+00:00 2026-06-15T12:11:01+00:00

This may be impossible, but I was wondering if its possible to output the

  • 0

This may be impossible, but I was wondering if its possible to output the content of a define using the value of a variable.

Like this:

define("SEO_HOME", "Home name");
$var="SEO_HOME";
echo $var

This will print off course “SEO_HOME”. How can I make it print “Home name” (using the variable $var)?

Edit: Corrected define.

Edit:
My all problem his, the site I’ll edit use defines to identify all pages, eg:

define("CONTACT_PAGE","Please contact us");
define("INFO_PAGE","Some information about us");

And I’ll need to add custom html title on those pages, that owner will be able to edit. So I was thinking I would create a DB table with (id, page, title) where page would have CONTACT_PAGE, INFO_PAGE, etc. and title would be the title itself.

Now to make an edit page for site owner, I’ll have this:

//This would be an while mysql_fetch_assoc and not a multidimentional array, but for example this will work
$titleArray=array(array("CONTACT_PAGE", "my title for contact page"),array("INFO_PAGE", "my title for info page"));
?>
<tr>
    <td>Set title for: <?php echo $titleArray[0][0];?></td> 
    <td><input type="text" name="name" value="<?php echo $titleArray[0][1];?>" /></td>
</tr>
<tr>
    <td>Set title for: <?php echo $titleArray[1][0];?></td> 
    <td><input type="text" name="name" value="<?php echo $titleArray[1][1];?>" /></td>
</tr>

This shows on first td -> Set title for: CONTACT_PAGE

And I wanted it to show -> Set title for: Please contact us

Hope this clarifies my doubt.

  • 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-15T12:11:03+00:00Added an answer on June 15, 2026 at 12:11 pm

    you can use constant function:

     mixed constant ( string $name )
    

    Return the value of the constant indicated by name.

    constant() is useful if you need to retrieve the value of a constant,
    but do not know its name. I.e. it is stored in a variable or returned
    by a function.

    This function works also with class constants.

    <?php
    define("SEO_HOME", "Home name");
    $var="SEO_HOME";
    echo constant($var);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be impossible, but I was wondering if it was possible to keep
this may be impossible, or rather, not very popular, but I was wondering how
This may sound like a very generic question but here it goes. I have
This may seem like a dumb question, but still I don't know the answer.
This may seem as an almost impossible question, but I wish to know how
I think what I am trying to do here may be impossible, but this
This may sound impossible but read on. I need to learn jQuery a little
I know this may be impossible but... I just got an app approved, and
This may be stupadly easy, or just impossible - but it's worth asking in
I think that this may be impossible, but what I was trying to do

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.