Category:PHP code
Not so long ago, I didn't like PHP because I didn't like having "code inside HTML." I preferred Perl, where the code was first, and the HTML was produced by the code. "HTML inside code"
At my job, I was basically required to use PHP, and... I have come to realize it is not actually all that bad. In fact, in several ways, it's pretty awesome.
I actually still believe that, and so here is what happened:
Basically, I think this type of coding is crap:
<source lang="php"> <?php //***********************************************// // // this code is crap and formatted as such // // // fantastic description of great program // // /***********************************************/
<html> <head> </head> <body>
title
Here is the thing for today: <?php $thing = $DB->getThing(date("Y.m.d")); echo $thing; ?> I love it!
</body> </html> </source>
I would see all types of things written inline, and I couldn't grok the overview of the code for anything.
I finally decided on this type of rule. For simple echo statements, such as
<source lang="php"><?php echo "echo statements"; ?></source>
I would happily code them inline. But if there was actual programming logic, I want that pulled "out"
<source lang="php"> <?php //***********************************************// // // this code is crap, but formatted nicely // // // fantastic description of great program // // /***********************************************/
<html> <head> </head> <body>
title
Here is the thing for today: <?php $thing = $DB->getThing(date("Y.m.d")); echo $thing; ?> I love it!
</body> </html> </source>
For me, this makes all the difference in the readability of the code.
Pages in category "PHP code"
The following 2 pages are in this category, out of 2 total.