Jump to content

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

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.