PHP Mixed-Mode Processing
In this chapter you will learn:
Description
PHP mixed-mode processing would allow us to mix PHP code with HTML code in the same page.
Syntax
<?PHP//from j a va2 s. co m
PHP code block start
?>
HTML code
<?PHP
PHP code block end
?>
Example
We can toggle PHP parsing mode. Here is a basic PHP script:
<?php/*from j av a 2 s . co m*/
if ($logged_in == true) {
print "Lots of stuff here";
print "Lots of stuff here";
print "Lots of stuff here";
print "Lots of stuff here";
print "Lots of stuff here";
}
?>
The code above can be rewrite as the follows.
<?php//from java 2s . co m
if ($logged_in == true) {
?>
Lots of stuff here
Lots of stuff here
Lots of stuff here
Lots of stuff here
Lots of stuff here
<?php
}
?>
Next chapter...
What you will learn in the next chapter:
- Why do we need to include another PHP file
- Syntax to include other files
- Example - include file
- How and when to use require keyword
- include_once() and require_once()
Home » PHP Tutorial » PHP Statements