Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 7th, 2006, 9:16 PM   #1
gumbyman31
Newbie
 
Join Date: May 2006
Location: Inside
Posts: 14
Rep Power: 0 gumbyman31 is on a distinguished road
Send a message via AIM to gumbyman31
Include variables

how would you use cross-script variables in php? Like, if you have script 1:

<?php 
$A=15
include ("script_2.php")
?>

And then in script 2:

print $A

would this print the value "15", or would you have to do some kind of redefining of the variable?

I know this is a bad example, but holefully you get the idea.
gumbyman31 is offline   Reply With Quote
Old May 8th, 2006, 3:06 AM   #2
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Have you tried out your above example to test if it works?
Arevos is offline   Reply With Quote
Old May 8th, 2006, 9:06 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
yes, that concept will work... I wrote something similar not to long ago.

script1.php
[PHP]
<?php
$area = "INDEX";
include ("script2.php");
?>
[/PHP]

script2.php
[PHP]
<?php
print $area;
?>
[/PHP]

output: INDEX
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old May 8th, 2006, 9:30 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Might I recommend the PHP manual?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 8th, 2006, 4:17 PM   #5
gumbyman31
Newbie
 
Join Date: May 2006
Location: Inside
Posts: 14
Rep Power: 0 gumbyman31 is on a distinguished road
Send a message via AIM to gumbyman31
yeah, i guess i shouldve started there. :o
gumbyman31 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:55 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC