[thelist] PHP inside or outside?

Marek Kilimajer kilimajer at webglobe.sk
Sat Apr 24 17:34:59 CDT 2004


Tony Crockford wrote:
> Yeah, I see that and sometimes that's teh way to go unless I'm mixing 
> in  javascript and then it really gets me confused!.
> 
> Maybe I'm misunderstanding the way PHP works?
> 
> if I have twenty lines of xhtml and one line with a PHP variable in it,  
> how does the parser work - doesn't it just pass the xhtml to the 
> browser  directly and only parse within <?php ?>
> 
> most times I'm making an xhtml template, getting it to work and then  
> adding the php logic, so it seemed to make sense to only use php where 
> I  really needed it and not for all the xhtml templating.
> 
> Is my understanding screwed?

I understand it the same way you do. php parser eats everything until 
the <?(php). And what I would consider more then the miliseconds it 
takes the parser to parse the code is the speed of development, and it 
helps me to see the html code syntax highlighted too, not only the php 
code. And I have not seen any editor that highlights html inside php 
strings. Another thing I would note that php inside html tends to output 
nicer html output.

That said, I'm fan of php inside html. :-)


More information about the thelist mailing list