Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: Embedding HTML Within a PHP Statement Date: Mon, 14 Nov 2011 13:39:40 +0100 Organization: A noiseless patient Spider Lines: 36 Message-ID: <4EC10C0C.7000800@arnowelzel.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="1gm8FlMTLcdkzSpiXSf0MA"; logging-data="8759"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9wTaSaDbJ+nRzu7YCxgQTQ5/RTL4q/Is=" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: Cancel-Lock: sha1:kAB0BzwvEzAR9oqMdtSWkSa7boE= Xref: x330-a1.tempe.blueboxinc.net comp.lang.php:3779 Call Me Tom, 2011-11-14 08:29: > I was under the impression that a section of PHP code (the part > between ) was independent of any other section of PHP > code. Today I found the following code in a working program: > > >

> > > This is the first time I have seen a section of PHP code end in the > middle of a PHP statement and restart after some HTML was inserted. I > was surpised that the PHP interpreter was able to connect the two > sections of PHP code. Well - this is the way how PHP works. The interpreter will just output all the stuff between ?> and My question is not how the interpreter does it (that's way beyond my > level of knowledge) but rather > 1. Does this only work in special cases or does it work in all > cases? This works in all cases. In fact this is by design, how PHP works. > 2. Is it considered good programming, bad programming or personal > preference? It depends on the situation. Usually it's easier to embed large HTML fragments than to output every single line using echo or print. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de