• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic PHP question

#10
Either one is fine. The performance difference is minimal. Use whichever works best for you and your needs.

That said, I find all of the PHP-based echos to make things much more difficult to scan through and read quickly. Whenever possible, I prefer to work in the language I'm actually using. If you're finding clarity lacking in your HTML code, then fix that: indent logically just as would your PHP code. Use HTML comments where necessary.

If you do use echo statements, please don't use the full version like you used in the example. There's a shorthand that is much cleaner for doing echoes:

Code:
<?= '<h2>My Site</h2>' ?>

Personally - better to use HTML and only use echoes where you need to output a variable. The person that reads your code after you will thank you for it.
Support Development  • Practical CodeIgniter 3  •
Myth:AuthVulcan - CLI Tools for CI4
Reply


Messages In This Thread
Basic PHP question - by ronniebel - 08-06-2019, 04:22 PM
RE: Basic PHP question - by includebeer - 08-06-2019, 05:14 PM
RE: Basic PHP question - by John_Betong - 08-06-2019, 11:12 PM
RE: Basic PHP question - by albertleao - 08-06-2019, 11:20 PM
RE: Basic PHP question - by includebeer - 08-07-2019, 02:57 AM
RE: Basic PHP question - by dave friend - 08-07-2019, 06:28 AM
RE: Basic PHP question - by John_Betong - 08-08-2019, 09:27 AM
RE: Basic PHP question - by includebeer - 08-08-2019, 10:12 AM
RE: Basic PHP question - by dave friend - 08-08-2019, 12:10 PM
RE: Basic PHP question - by kilishan - 08-08-2019, 02:27 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.