Php: Difference between revisions
No edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
echo 'Hello World'; | echo 'Hello World'; | ||
?> | ?> | ||
</source> | |||
==== Mixing with HTML==== | |||
<source lang="php"> | |||
<?php | |||
// this is a PHP comment | |||
$myHeader = "Header made with echo"; | |||
echo "<h3>".$myHeader."</h3>"; | |||
?> | |||
<!-- Is similar to (note HTML comment) --> | |||
<?php $myHeader2 = "Header made with with HTML"; ?> | |||
<h3> <?php echo $myHeader2; ?> </h3> | |||
</source> | </source> | ||
Revision as of 21:45, 21 April 2013
- Server side programming language
- frameworks
- php.net
- LAMP
- error logs /cat /var/log/apache2/error.log / run file
Hello World
- mixing
<!DOCTYPE html>
<meta charset=utf-8>
<title>PHP Test</title>
<?php
echo 'Hello World';
?>
Mixing with HTML
<?php
// this is a PHP comment
$myHeader = "Header made with echo";
echo "<h3>".$myHeader."</h3>";
?>
<!-- Is similar to (note HTML comment) -->
<?php $myHeader2 = "Header made with with HTML"; ?>
<h3> <?php echo $myHeader2; ?> </h3>
Syntax
function myFunction() { //declares a function, this is named myFunction
return 'John Doe'; //returns the value 'John Doe'
}
echo 'My name is ' . myFunction() . '!'; //outputs the text concatenated with the return value of myFunction.
//myFunction is called as a result of this syntax.
//The result of the output will be 'My name is John Doe!'