Jump to content
Larry Ullman's Book Forums

Chapter 9-9.11 Confusion On Set_Include_Path

Recommended Posts

$path = '/usr/local/pear/share/pear/';

set_include_path(get_include_path() . PATH_SEPARATOR . $path);

What does this line do?


PHP documentation explains it as extending the include path.


In this example we add /usr/lib/pear to the end of the existing include_path.



$path = '/usr/lib/pear';

set_include_path(get_include_path() . PATH_SEPARATOR . $path);


echo outputs :



Can someone please break down the concept for me?


Also login seems to work when even if I do this:

(path where QuickForm2 is installed for my setup:

Ubuntu 16.10 xampp-5.6.30-0)

$path = '/opt/lampp/lib/php/HTML/';
Link to comment
Share on other sites

Am not sure if my understanding of the concept is correct, so I'd appreciate any input to help me with it.

set_include_path(get_include_path() . PATH_SEPARATOR . $path);

This line tells PHP to first search for the included file (in this Script "require('HTML/QuickForm2.php');") in the path returned by "get_included_path()". If the file is not found there, then PHP will look for the file in "$path".


Have I got it right?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...