SDD Topic has been refreshed!
This page is to give examples of some basic PHP syntax. PHP is a object oriented server side scripting language.
<?php
for ($i = 1; $i <= 10; $i++) {
echo $i;
}
?>
There are more - for further information: http://php.net/manual/en/language.operators.comparison.php
The following example would display a is bigger than b if $a is bigger than $b:
<?php
if ($a > $b)
echo "a is bigger than b";
?>
The following code would display if a is bigger than b, a is equal to b or a is smaller than b:
<?php
if ($a > $b) {
echo "a is bigger than b";
} elseif ($a == $b) {
echo "a is equal to b";
} else {
echo "a is smaller than b";
}
?>
?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
?>
<?php
$i = 1;
while ($i <= 10) {
echo $i++;
}
?>
<?php
$i = 1;
while ($i <= 10):
echo $i;
$i++;
endwhile;
?>
<?php
$i = 0;
do {
echo $i;
} while ($i > 0);
?>