Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

coding question

Status
Not open for further replies.

wolf73

Programmer
Feb 12, 2006
93
CA
I am trying to understand this code, I don't know what they are doing


define("DEBUG",false);



if ($_REQUEST['DEBUG'])
{
dl("no-debug-non-zts-20050922/xdebug.so");
xdebug_start_profiling();
}



****************

if (isset($_GET['app']))
{
$include_path="{$_GET['app']}/";
$s->check_includes($_GET['app'],"app");
}
 
the definition is not used elsewhere in the script you have provided.

the first conditional tests the value of $_REQUEST['DEBUG'] this could be either a get, post of cookie array element called DEBUG. if it is set to TRUE then the xdebug.so dynamic php extension is loaded and a function within that library is called.

the second conditions tests to see whether a get element called "app" is set. if it is then a variable called $include_path is populated with the value of that array element with a trailing slash and a call to a method of an object ($s) is made with some variables.
 
Thanks for your reply. Now

define("DEBUG",false);

Thats a constant that has nothing to do with
if ($_REQUEST['DEBUG'])

right
 
correct.

if you had
Code:
$ARRAY['somevalue'] = "apple";
define ("DEBUG", "somevalue");
echo $ARRAY[DEBUG];
you would get
Code:
apple
as the array element has no quotes, php assumes at first that you are referencing a constant. The $_REQUEST is a superglobal construct made up of GET POST and COOKIE values and is independent of any constants set up in the script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top