Im trying to generate statistics on which quote will be displayed each time i refresh the page.
I've stored 10 famous quotes in the $famous_quotes array but have no idea on how to find out which 1 has been selected and then to generate the stats for that quote (if its even possible!!!)
Have been stuck on this problem for 4 days now!! So any help would be appreciated.
This is the code used for storing and randomising my quotes.
Expand|Select|Wrap|Line Numbers
- $famous_quotes=array("Imagination is more important than knowledge - Albert Einstein",
- "If music be the food of love, play on - Shakespeare",
- "Never let your sense of morals get in the way of doing what's right - Isaac Asimov",
- "Obstacles are those frightful things you see when you take your eyes off the goal - Henry Ford",
- "When you come to a fork in the road, take it - Yogi Berra",
- "We may affirm absolutely that nothing great in the world has been accomplished without passion - Hegel",
- "The life which is unexamined is not worth living - Socrates",
- "Live as if you were to die tomorrow. Learn as if you were to live forever - M.K. Gandhi",
- "What you get by achieving your goals is not as important as what you become by achieving your goals - Zig Ziglar",
- "A lie gets halfway around the world before the truth has a chance to get its pants on - Sir Winston Churchill");
- print_r($famous_quotes);
- $random = rand(0, 9);
- echo $famous_quotes[$random];
Have tried things like
Expand|Select|Wrap|Line Numbers
- if ($random = 1)
- {
- $a = 0;
- $a++;
- }
But nothing works!!!