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
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts

    include (file) ?

    I need to use the include function but I need the file name to use a variable as part of it. ie,

    include ('/folder/$var.inc');

    but this doesn't work and I can't figure how to do it. Any hints, tips would be appreciated.

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Variables aren't parsed in single quotes, you can either change them to double quotes or do something like
    PHP Code:
    <?php
    include('/folder/'.$var.'.inc');
    ?>

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts
    thanks .. I am embarrased at the simplicity of the answer, appreciate you help.


  •  

    Posting Permissions

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