snippet follows; notice that the JavaScript has been left intact and untouched, but the PHP code has been evaluated. PHP ignores the JavaScript code completely:
As you can see, this code will cause JavaScript errors when executed. Be cautious when combining PHP and JavaScript code: It can be done, but it must be done with attention to the fact that the PHP will always be evaluated without regard for the JavaScript. To successfully combine the two, it?s generally necessary to output JavaScript code with PHP.
The following example does just that:
25
7 Running Your New Program
Following the same procedure outlined at the beginning of this article, try running this program.
Your program display “Hello, World!” in your browser.
26