Jump to content

Archived

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

levivel

array question

Recommended Posts

Hello,

My task is to read a list of values from MySQL, compare it to a list from an array, ignore the values that exist both in the MySQL list and the array list, and select a random value from the remaining array. I've found functinos like array_slice, array_rand, multisort_array, but I can't seem to be able to put together the whole picture. Could anyone point me in the right direction?

Thanks very much,
Levi

Share this post


Link to post
Share on other sites
http://www.php.net/in_array checks if a value is in an array

http://www.php.net/unset will remove array elements

http://www.php.net/array_rand will return a key at random from the remaining array

Share this post


Link to post
Share on other sites

×

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.