note 91931 added to language.basic-syntax.phpmode

From: Date: Thu, 02 Jul 2009 06:56:21 +0000
Subject: note 91931 added to language.basic-syntax.phpmode
Groups: php.notes 
Request: Send a blank email to php-notes+get-157797@lists.php.net to get a copy of this message
Even if it's pretty simple to insert echo lines to your PHP, I would storngly advise against it. The safest way to output HTML content which may have special chraracters is to remove the HTML from your core code. Put them in heredocs instead. See the heredoc documentation and comments for more examples. If you can remove as much of the HTML as you can from the rest of the PHP code (in terms of printf and echo lines), please do. Try to keep your core logic and presentation separate. <?php $html =<<<HTML <?xml version="1.0" encoding="UTF-8" ?> ... The rest of your HTML... And a PHP {$variable} here and an array {$arr['value']} there. HTML; // End of heredoc // Print this HTML echo $html ?> ---- Server IP: 69.147.83.197 Probable Submitter: 98.229.186.63 ---- Manual Page -- http://www.php.net/manual/en/language.basic-syntax.phpmode.php Edit -- https://master.php.net/note/edit/91931 Del: integrated -- https://master.php.net/note/delete/91931/integrated Del: useless -- https://master.php.net/note/delete/91931/useless Del: bad code -- https://master.php.net/note/delete/91931/bad+code Del: spam -- https://master.php.net/note/delete/91931/spam Del: non-english -- https://master.php.net/note/delete/91931/non-english Del: in docs -- https://master.php.net/note/delete/91931/in+docs Del: other reasons-- https://master.php.net/note/delete/91931 Reject -- https://master.php.net/note/reject/91931 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#157797) next »