Jump to content

comparing arrays


Ustag

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?

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

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...