Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Using constants

  1. #1
    New Coder
    Join Date
    Sep 2006
    Posts
    92
    Thanks
    4
    Thanked 1 Time in 1 Post

    Using constants

    Hello,

    I have a little issue with the usage of constants in PHP.
    In the config file I want to define constants for example to point to the current version of the software used :

    PHP Code:
    define("VERSION""/var/www/html/domain/code/beta/1.0"); 
    Now when I want to use this in require_once statements it is not working how I would expect it and so I hope someone can help me out what am doing wrong here:

    PHP Code:
    require_once("VERSION/database.inc.php"); 
    I have tried to use {} around the constant name, but this also doesn't work.
    What am I doing wrong please?

    Many thanks,
    twomt
    Nemesis War
    Online browser based space combat game.
    It's free, it's great, you'll love it.
    Come join us at http://www.nemesiswar.net/

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,080
    Thanks
    2
    Thanked 321 Times in 313 Posts
    Should work -
    PHP Code:
    require_once(VERSION "/database.inc.php"); 
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • Users who have thanked CFMaBiSmAd for this post:

    twomt (01-07-2008)

  • #3
    New Coder
    Join Date
    Sep 2006
    Posts
    92
    Thanks
    4
    Thanked 1 Time in 1 Post

    Thumbs up

    Quote Originally Posted by CFMaBiSmAd View Post
    Should work -
    PHP Code:
    require_once(VERSION "/database.inc.php"); 
    Thanks... exactly what I needed
    Nemesis War
    Online browser based space combat game.
    It's free, it's great, you'll love it.
    Come join us at http://www.nemesiswar.net/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •