【发布时间】:2022-07-07 20:30:11
【问题描述】:
可以在php中做"in"吗? python 中的类似内容:
test = ["Hi", "Hello", "Good morning"]
msg = input("Hello!\n")
if msg in test:
print("Hello, you are a good boy!")
else:
print("Try it again please!")
【问题讨论】:
-
PHP 没有
in运算符,您需要例如in_array.