Get Constant's value from a string

How can I get a defined constant’s value by using its corresponding string name?

For example, CURLOPT_REFERER is a meaningful defined constant in PHP. My script intakes this name as string.

$name = 'CURLOPT_REFERER';

Now, my concern is to receive the value of CURLOPT_REFERER as integer/long into some other variable by using $name input. How is this possible?

Thanks.

Not sure I understand 100% what you are looking for but

If constant was already defined :

then

$name = CURLOPT_REFERER;

Just remove the quotes

Also if you are thinking of accessing the constant by some dynamically built variable

then you can use function constant()

$name = 'CURLOPT_REFERER';  
$constantValue = constant($name );
echo $constantValue;

Thanks to hostentic.
It works as the way I wanted.