PHP & HTML: Do’s and Don’ts

I have been working with PHP for over 14 years, and I only know the basics. If I need to code anything complicated, then I just find the answer on Google. It’s usually a combination of PHP and JavaScript/jQuery/HTML, but I usually solve it.

Side story: One time I was asked by some human resources lady of how many years experience I have with PHP, and I told her. She said, “It hasn’t been around that long!” I am not sure I was dumfounded by her response or astounded by some people’s lack of knowledge about technology.

Anyways, if you are an experienced HTML coder, then you can learn and apply PHP scripting to make your web page dynamic. I have edited many 3rd party PHP scripts, and I really get annoyed by scripts that include HTML in the echo statements. Here is an example:

PHP

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

<?php

//variables

$i=1;

$j=2;

if($i<$j){

//print out the results

echo"<p><h3>Variable i is smaller than variable j.</h3></p>";//why echo