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

From: Date: Fri, 04 Oct 2024 07:38:39 +0000
Subject: note 129791 added to language.basic-syntax.instruction-separation
Groups: php.notes 
Request: Send a blank email to php-notes+get-221576@lists.php.net to get a copy of this message
When running the code on a browser (firefox / chrome) <?php echo "Some text"; ?> No newline <?= "But newline now" ?> would be rendered as : Some textNo newline But newline now To see the effect of "end tag encompassing trailing newlines", wrap them in <pre> tags. <pre> <?php echo "Some text"; ?> No newline <?= "But newline now" ?> </pre> now this yields the same as the intended output: Some textNo newline But newline now The simple explanation to this is we are actually echoing a text and not an element, which has a default style when displayed by the browser. Since it's displaying plain text the browser removes all the undeclared whitespace after being parsed by php before it actually displays the text. So using <pre> or <br> would preserve the parsed php code. ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 136.158.78.49) ---- Manual Page -- https://php.net/manual/en/language.basic-syntax.instruction-separation.php Edit -- https://main.php.net/note/edit/129791 Del: integrated -- https://main.php.net/note/delete/129791/integrated Del: useless -- https://main.php.net/note/delete/129791/useless Del: bad code -- https://main.php.net/note/delete/129791/bad+code Del: spam -- https://main.php.net/note/delete/129791/spam Del: non-english -- https://main.php.net/note/delete/129791/non-english Del: in docs -- https://main.php.net/note/delete/129791/in+docs Del: other reasons-- https://main.php.net/note/delete/129791 Reject -- https://main.php.net/note/reject/129791 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221576) next »