Teacher, is this relational operation? What's wrong if it doesn't work? How to throw an exception? What are the purpose and advantages of writing this way?
replyI also thought it would report an error, but this is a screenshot of the video. In the video, the teacher wrote this and there was no error. So I'm confused. I don’t know if the video was edited.
1. Generally, variables are placed on the left, for example: $a=2,$a=ture
2. in_array returns a Boolean value and is generally used in judgment statements, such as: if(in_array($ a,$b)) like this
3, there is a difference between "=" sign and "==", "=" means assignment, "==" means comparison
Therefore, you will get an error
above.