$name = 'John Doe';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$age = 16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$address = 'Planet Earth';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Should this be considered a bug? PHP does not return any syntax errors at all.
Omitting the semicolon at the end of a statement is a syntax error. The computer issues an error message when it cannot recognize the statement. These messages can occur at the point of the error, or after it.
Compile Time Errors are those errors which prevent the code from running because of an incorrect syntax such as a missing semicolon at the end of a statement or a missing bracket, class not found, etc.
A semicolon is used to connect two independent clauses. In this case, the phrase that follows the semicolon is not an independent clause (a complete sentence that can stand on its own), so the use of a semicolon here is incorrect. Changing the semicolon to a comma would correct the sentence's error.
Since the for loop executes a single operation (which could be a block enclosed in {} ) semicolon is treated as the body of the loop, resulting in the behavior that you observed. is interpreted as follows: Repeat five times for (i=0;i<5;i++) ... do nothing (semicolon)
It's not an error. It's just a statement with nothing in it. Perfectly valid.
This is valid - It's just an empty statement
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With