Jump to content

Recommended Posts

Hi,

I would like to generate a constant value that change from a website to website but have an identical value for a single website. For example 

$_SERVER['SERVER_ADDR']

doesn't change for a single website, but easy to guess. an other idea is 

realpath(dirname(__FILE__))

but this can change if the web application execute scripts located in sub directories of the main script that use this variable. So what other possibilities to get a constant value that doesn't change ?

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/290408-ideas-to-generate-a-constant-value/
Share on other sites

Yes - this is a very confusing question.  "A Constant value that doesn't change"?  What a misnomer - a constant is Exactly that - a constant.  To ask for "a constant that doesn't change" is simply idiotic. 

 

So - as Cronix says - "What are you really looking for?".

I would like to generate a constant value that change from a website to website but have an identical value for a single website.

 

 

Like the website URL?

$_SERVER['REQUEST_URI']

 

Like others said, it's not really clear what you want to acheive. Do you need something so that you can hardcode conditions in a development/test/production website?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.