SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    canada
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Include in class inq

    Hello

    Questions round class and include:

    Is it ok to add include example include('dbconfig') within a class?

    At first I thought having includes in a class wasn't the right format but I ran into a tutorial which included include('dbconnect') in a class.

    <?php

    include('dbconnection'); < -- Can you add includes here ?????

    class testclass
    { method1() {}
    method2() {}
    }

    ?>

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Personally I don't see why you can't do this as when you need a dependency for a specific class the only solution is to include it directly before the class or within it, unless someone knows why this is a bad idea I say just go with it.

  3. #3
    Non-Member
    Join Date
    Oct 2007
    Posts
    363
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

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