We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
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.
|