Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TASK(PHP): Use a while-loop to simulate a dice roll (random number between 1-6). Stop the loop when a 6 is rolled. Task Description This is

TASK(PHP): Use a while-loop to simulate a dice roll (random number between 1-6). Stop the loop when a 6 is rolled.

Task Description This is a very simple task to help you understand how to use a while loop. Your task is to simulate rolling a standard dice until a 6 is reached. To do that, create a variable called $dice and first assign it -1. Then create a while loop that keeps looping until $dice is equal to 6. You need to think carefully about what is the appropriate condition for this loop. Inside the loop, assign a new random variable to $dice and print out the value (as shown above).

PHP Arrays, Strings, and File

ini_set('display_errors', 1); # only need to call these functions error_reporting(E_ALL); # one time ?>

Lab 4

lab


Task 1: While loop

Simulate multiple dice rolls until a 6 is reached. Print out the results of each roll.

?>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

2. Be a good example:

Answered: 1 week ago