Jump to content

How can i use a variable to get an array from another php file?


Jarid

Recommended Posts

I am trying to use the variable $RATETHESE to include an array into file A. The array is in file B.

 

PhP File A

include_once(dirname(__FILE__) . '/PhpFileB.php');
global $RATETHESE;
$VALID_RATING_IDS = $RATETHESE;

 

 

Php File B

$RATETHESE = "array("1", "2");"

 

 

For some reason it is printing the array on the page, and the array is not being used to run the script. Did i do anything wrong?

Link to comment
Share on other sites

The php script printed

$RATETHESE = array("1", "2")
on the page it was included on. This does not happen if i replace
$VALID_RATING_IDS = $RATETHESE;

with

$VALID_RATING_IDS = array("1", "2")

Is there anyway i can include the array from PhpFileB.php into the script without it being printed on the page? 

Link to comment
Share on other sites

Is there anyway i can include the array from PhpFileB.php into the script without it being printed on the page? 

 

Is all this code within <?php ?> tags? Post your ACTUAL code. It won't print if done properly.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.