Basically you write a variable. Variable names must be in this format:
(Dollarsign)(Alpha-numeric characters)
So a valid variable name would be:
Code: Select all
$vari
Code: Select all
vari
Code: Select all
$vari = 1
Code: Select all
$vari = Hey there
If you forget, you will get an error along the lines of:
Parse Error: Parse error on line xx
So a valid line would be:
Code: Select all
$vari = Hey There;
Code: Select all
<?php
Code: Select all
?>
Code: Select all
echo
Code: Select all
echo 'Put your text in here';
Code: Select all
echo $vari;
An example of good code, from top to bottom:
Of course you don't include the text which I have highlighted in italic, that will just confuse PHP and throw up a parse errorThis PHP Script wrote: <?php <<< Start PHP code
$forum_age = 8; <<< Variable
echo 'This forum has been up for '; <<< Note the space between for and '
echo $forum_age; <<< Variable, no '' needed
echo ' '; <<< Space to go after the variable
echo 'months'; <<< Just a word, need ''
echo '<br />'; <<< HTML can be used
?> <<< End PHP Code
If you want to see it without the italics:
The final product would be:This PHP Script wrote:<?php
$forum_age = 8;
echo 'This forum has been up for ';
echo $forum_age;
echo ' ';
echo 'months';
echo '<br />';
?>
This forum has been up for 8 months
Used in this example, it's not as effective as HTML but when you start getting SQL (Database) queries they become very useful