[thelist] PHP inside or outside?

Richard Davey rich at launchcode.co.uk
Sat Apr 24 08:28:27 CDT 2004


Hello Tony,

Saturday, April 24, 2004, 1:00:23 PM, you wrote:

TC> I also find it easier to read  echo'd php variables within html than to
TC> read echo'd html within PHP
TC> (all those escaped characters - makes it look really untidy.)

I'd have to disagree on this one for the simple fact that if you're
writing XHTML compliant code, you need to quote everything - and if
you're injecting variables into your echo statement, you then need to
escape all of the quotes which can lead to lots of parser errors IMHO.

(or you echo with single quotes and then cannot use variables inline,
so have to break out, concat them, etc.. quite messy too).

The more times you swap in and out of HTML/PHP, the more work the PHP
parser has to do - but to be honest I bet the speed difference in this
regard is absolutely tiny, so it's best to treat this one as a "do
whatever suits you" situation.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html




More information about the thelist mailing list