Hello,

I have a strange problem with one of my applications.

Consider the following code:
function getBanner() {
                $banners_tmp = Cache::read('banners');
                if(empty($banners_tmp))
                {
                        $this->loadModel('Position');
                        $this->Position->cacheBanner();
                        $banners_tmp = Cache::read('banners');
                }

                //srand(floor(time() / (60*60*24)));
               //debug(rand() % count($banners_tmp));

                //return $banners_tmp[rand() % count($banners_tmp)];
                return $banners_tmp[array_rand($banners_tmp)];
        }

array_rand always return the first element of my array. I also used
srand and rand()%count() but with same result. Is there a problem with
cake and rands?

thanks a lot

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to