Is there a way to make a diffrent text appear, when the page is refreshed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is there a way to make a diffrent text appear, when the page is refreshed?

Alright, so, I want like diffrent questions appearing everytime you go in and out or refresh the page... Not sure if it's possible. Because I had this idea on twitch when you say !question everytime a diffrent question appears, but do that as a mod. Not as the streamer. And if there's a way to make a diffrent text appear once refreshed the page, can you please tell me how? Thanks.

8th Dec 2018, 1:23 PM
Ars Sea
5 Answers
+ 1
It can be easily done in js in front end, and any server side language. For example in js alert(welcome[Math.floor(Math.random()*welcome.length])); create an array of text you want to show, then choose random number from 0 to last index. then choose element from array using that random number btw, delete the double post -> https://www.sololearn.com/Discuss/1613905/
8th Dec 2018, 1:44 PM
Taste
Taste - avatar
+ 1
In modern high level language, yes array are everywhere. And yes php has array
8th Dec 2018, 2:17 PM
Taste
Taste - avatar
0
Point is I don't unserstand half of this stuff xd
8th Dec 2018, 1:37 PM
Ars Sea
0
Wait, so the "array" thing is in every language? Because I decided to learn php as it seems easy..
8th Dec 2018, 2:09 PM
Ars Sea
0
Alright, thanks mate, made the code you can change the questions if ye want
8th Dec 2018, 2:17 PM
Ars Sea