Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-19-2010, 03:25 AM   PM User | #1
Joseph Witchard
Regular Coder

 
Join Date: Oct 2008
Posts: 255
Thanks: 113
Thanked 0 Times in 0 Posts
Joseph Witchard is an unknown quantity at this point
Php self

Consider this file:

PHP Code:
// error_check.php

function error_check($email)
{

   
$subject 'ERROR!';
   
$script $_SERVER['PHP_SELF'];
   
$message "There was an error on example.com$script";

   
mail($email$subject$message);


Now consider this file:
PHP Code:
// do_something.php

require('error_check.php');

$to 'someone@example.com';

error_check($to); 
So, since error_check.php is included via require(), what will the PHP_SELF variable be? Since it's included in the second file, would it have the value /do_something.php, or since it is declared in the first file, will it have the value of /error_check.php?

Last edited by Joseph Witchard; 02-19-2010 at 05:30 AM..
Joseph Witchard is offline   Reply With Quote
Old 02-19-2010, 03:29 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Why don't you comment out the mail part and echo the $script variable and test it yourself?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Users who have thanked _Aerospace_Eng_ for this post:
Joseph Witchard (02-19-2010)
Old 02-19-2010, 03:29 AM   PM User | #3
bdl
Regular Coder

 
Join Date: Apr 2007
Location: Camarillo, CA US
Posts: 590
Thanks: 4
Thanked 83 Times in 82 Posts
bdl is an unknown quantity at this point
PHP superglobals : $_SERVER

Quote:
The filename of the currently executing script, relative to the document root.
bdl is offline   Reply With Quote
Users who have thanked bdl for this post:
Joseph Witchard (02-19-2010)
Old 02-19-2010, 05:30 AM   PM User | #4
Joseph Witchard
Regular Coder

 
Join Date: Oct 2008
Posts: 255
Thanks: 113
Thanked 0 Times in 0 Posts
Joseph Witchard is an unknown quantity at this point
Quote:
Originally Posted by _Aerospace_Eng_ View Post
Why don't you comment out the mail part and echo the $script variable and test it yourself?
I'm sorry.
Joseph Witchard is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:21 AM.


Advertisement
Log in to turn off these ads.