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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.