使用函数为PHP生成数字 [英] Using functions to generate numbers for PHP

查看:58
本文介绍了使用函数为PHP生成数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在练习中遇到问题



创建一个程序,随机生成-​​3到3之间的数字并显示数字。如果数字为零,1和-1,程序也应该继续



当数字不是-1,0或1时,程序将显示Good Job !否则,程序将显示无效





请让我理解这个编码!!



我尝试过:



Im having trouble with this exercise

Create a program that randomly generate numbers between -3 and 3 and display the number. The program should also continue if the numbers are zero, 1 and -1

When the numbers is not -1, 0 or 1, the program will display "Good Job!" otherwise, the program will display "invalid"


PLEASE MAKE ME UNDERSTAND THIS CODING!!

What I have tried:

echo "<h3> Activity 1: continue function </h3>";
$random = rand(-3,3){
  Echo "The random number is: $random";
  echo "<br>"

推荐答案

random = rand(-3,3){
Echo 随机数为:
random = rand(-3,3){ Echo "The random number is:


random;
echo < br>


[更新,感谢 Mohibur Ra​​shid ]

你的意思是

[Updated, thanks to Mohibur Rashid]
Do you mean
while (true)
{


这篇关于使用函数为PHP生成数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆