SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question function giving me trouble

    What I can do:
    function createDir($path = '/path/to/root/')

    What I need to do:
    $server_root = $_SERVER['DOCUMENT_ROOT'];
    function createDir($path = $server_root)

    or this:
    function createDir($path = dirname($_SERVER['SCRIPT_NAME']))

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Why don't you just pass it in when you execute the function as from memory there is no way to pass variables or functions as part of a argument value from outside the function scope.
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle


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
  •