Semicolon after closing curly bracket in PHP

前端 未结 4 1013
遇见更好的自我
遇见更好的自我 2020-12-07 02:04

I am writing a script to make chunks of a text and send it via SMS. Earlier today i was reviewing some code to split the string in chunks and i saw something I\'ve never see

4条回答
  •  萌比男神i
    2020-12-07 02:18

    These are unnecessary. They don't hurt the script, just unnecessary. The programmer probably had a habit of adding semicolons to end of every statement. Maybe he got this habit from another programming language, maybe his IDE was showing errors without semicolons or maybe he is just a beginner. In any event, there neither hurt nor help. Also the fact that programmer uses while(1) tells me that he is either extremely lazy, because usually a programmer would write while(true), the only reason to type while 1 is because it's less typing to do. A programmer with any type of formal training will not not write while(1) instead of while(true). This is just my opinion, but it's based on over 10 years of programming in 3 languages.

提交回复
热议问题