Friday, 15 June 2012

HTML coding and/or echo function inside a php file. Whats the difference? -



HTML coding and/or echo function inside a php file. Whats the difference? -

consider loop in php file. printing html coding in 2 ways.

method 1: html coding...

class="lang-html prettyprint-override"><?php for($i=0; $i<5; $i++) { ?> <b>hello</b><br /> <?php } ?>

method 2: pure php coding...

class="lang-html prettyprint-override"><?php for($i=0; $i<5; $i++) { echo "<b>hello</b><br />"; }

both methods working fine. want know these:

which has less processing time? is there right way of representation? using wrong way? which method programmers prefer work with? why? whats overall difference?

which has less processing time? both have same processing time!

is there right way of representation? using wrong way? depends on user. both correct.

which method programmers prefer work with? why? developer, prefer html version, easy work on html rather within "s. if working both frontend architects , php developers, html way preferred frontenders... :)

whats overall difference? readability? html version has many advantages when using in ide, ide can autosuggest tags, attributes, values, etc. also, if using complex quotes, in mixture of ' , ", php doesn't need come inside.

php html

No comments:

Post a Comment