![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
|
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. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Have you tried out your above example to test if it works?
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#5 |
|
Newbie
|
yeah, i guess i shouldve started there. :o
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|