Jump to content

Ideas to generate a constant value


kolum

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.