How to pick random entries from events list
-
I try to pick only two random events from a list using this code
‘$events = EM_Events::get(array(‘scope’ => $data_oggi, ‘format’=>’*format data*’));
$rand_keys = array_rand ( $events, 2 );
echo $events[$rand_keys[0]];
echo $events[$rand_keys[1]];’but it gives me this error:
Catchable fatal error: Object of class EM_Event could not be converted to stringHow can I fix it?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to pick random entries from events list’ is closed to new replies.