shamuraq Posted July 17, 2009 Share Posted July 17, 2009 Hi All, I need help with creating random picked numbers from simple multidimensional array... <? $fraction = array( array("M2",2,4,6,8,10); array("M3",3,6,9,12,15); ); $m_set = array_rand($fraction, count($fraction)); $numerator = array_rand($m_set, count($m_set)); $denominator = array_rand($m_set, count($m_set)); ?> I can't seem to get it working. Is it true that array_rand don't work with multi-dimensional array? If so, how do i go around it? Thanx in advance guys... Link to comment https://forums.phpfreaks.com/topic/166316-array_rand-for-multidimensional-arrays-please-anyone/ Share on other sites More sharing options...
rhodesa Posted July 17, 2009 Share Posted July 17, 2009 What are you trying to accomplish exactly? Select one numerator and one denominator or randomize the values and create several fractions? edit: Please don't double post Link to comment https://forums.phpfreaks.com/topic/166316-array_rand-for-multidimensional-arrays-please-anyone/#findComment-877065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.