Jump to content

comparing arrays


Ustag
 Share

Recommended Posts

Hello, I have a problem comparing arrays and printing them. My code looks soemthing like this:

$players_world = array();$players_world[] = $td->nodeValue; $players_guild = array();$players_guild[] = $td2->nodeValue; echo array_intersect($players_world, $players_guild);

This should print a number of names but I only get "Array", how come?

Edited by Ustag
Link to comment
Share on other sites

it sounds like the array_intersect() function is returning an array. try this to quickly see the values in the array:

$results = array_intersect($players_world, $players_guild);print_r($results);

edit: you cant just echo out the array you would need to specify which of the values in the array that you want to echo out. http://www.w3schools.com/php/php_arrays.asp

Edited by astralaaron
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...