Jump to content

essensial defines


corillo181

Recommended Posts

hey i'm trying to fine what are some variables you would consider a must define..

example, i wastrying to make a define that always takes my to the root of my website.

i try define(__ROOT__,$_SERVER['HTTP_HOST']);

but this root doesnt work.

can anyone help me.

thank you.

 

if you want to include any define that you use often please let me know about it, i am building a large website so any shortcuts for later use would be of great help.

Link to comment
https://forums.phpfreaks.com/topic/89196-essensial-defines/
Share on other sites

The first perameter expected by the define function is a string. To make your code valid would require it to be...

 

<?php

define("__ROOT__", $_SERVER['HTTP_HOST']);

// then to use your newly created constant.

echo __ROOT__;

?>

 

I would not however recommend naming constants with __CONSTNAME__ as these are typically reserved for use as php defined magic constants.

 

Link to comment
https://forums.phpfreaks.com/topic/89196-essensial-defines/#findComment-456752
Share on other sites

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.