note 124890 added to language.basic-syntax.instruction-separation

From: Date: Tue, 07 Apr 2020 22:58:00 +0000
Subject: note 124890 added to language.basic-syntax.instruction-separation
Groups: php.notes 
Request: Send a blank email to php-notes+get-214428@lists.php.net to get a copy of this message
Note: If you do not add the closing tag like so you will get a parse syntax error (This will produce a syntax parse error) <?php echo "hello world" (Valid statement, omitting the trailing semicolon) <?php echo "hello world"?> If you have multiple statements for example <?php echo "hello world" echo "hello earth" ?> The code above will produce a parse error the only way to omit the semicolon in a multiple php statement program will be to terminate each php statement with the semicolon besides the last statement in your php code block. (example below of a valid multiple php statements omitting the semicolon) <?php echo "random text"; echo "more random text" ?> I do not recommend this type of programming style, and you shouldn't either. It is always best to add the trailing semicolon behind each statement even if you have only one single line statement. By adding the semicolon to each statement you and your users will run into less errors. Specially if you have a large program, looking for a missing semicolon will be time consuming. This example is just to demonstrate how to omit the semicolon. (which again is not recommend at all) ---- Server IP: 45.112.84.4 Probable Submitter: 38.142.137.34 (proxied: 73.58.102.23) ---- Manual Page -- http://php.net/manual/en/language.basic-syntax.instruction-separation.php Edit -- https://master.php.net/note/edit/124890 Del: integrated -- https://master.php.net/note/delete/124890/integrated Del: useless -- https://master.php.net/note/delete/124890/useless Del: bad code -- https://master.php.net/note/delete/124890/bad+code Del: spam -- https://master.php.net/note/delete/124890/spam Del: non-english -- https://master.php.net/note/delete/124890/non-english Del: in docs -- https://master.php.net/note/delete/124890/in+docs Del: other reasons-- https://master.php.net/note/delete/124890 Reject -- https://master.php.net/note/reject/124890 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214428) next »