ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Common Style Mistakes, Part 2
Subject:   heredoc and parameters
Date:   2003-07-15 10:29:56
From:   shmert
Thanks for clearing up the heredoc syntax, I've seen it here and there and never understood what it was doing. I think I'll definitely use that when generating dynamic HTML, since escaping quotes is always a big mess.


As for the snews() function, you could also take a more Objective-C style approach and just include some variable names when calling the method:
<?php
generateNewsTable($maxrows=1, $offset=42, $background="#336699");
?>


This is good for functions which are used in many different places, with different parameters, in which case you probably wouldn't want to define() a parameter for each instance.