Jump to content

[SOLVED] Random Strings!


DJTim666

Recommended Posts

I want to know how I can run random strings set by me. Here is the code that I want to randomize.

 

<?php
$answer1 = "Yes";
$answer2 = "No";
$answer3 = "Maybe";
$answer4 = "I'm not sure";
$answer5 = "Possibly";
$answer6 = "For sure";
$answer7 = "Precisly";
$answer8 = "Why ask me? I'm just a computer.";

$answerRandom = rand($answer1, $answer8);
?>

 

Any help would be appreciated!

 

--

DJ

Link to comment
https://forums.phpfreaks.com/topic/54909-solved-random-strings/
Share on other sites

im pretty new to php, but couldnt you just create a random interger?

 

ok here is the idea

 

$random=rand (1, 7)

 

 

 

then use that to choose the string???

 

would that work?

 

echo $answer$random

 

i dont know for sure, like i said, im pretty new...dont know syntax and whatnot...its an idea though.

Link to comment
https://forums.phpfreaks.com/topic/54909-solved-random-strings/#findComment-271555
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.