Working with PHP codes
<?php
$card_number = "01 2345 6789";
$digits = substr($card_number, 8);
echo "The last digits numbers of your card are: ** **** " . $digits;
?>
<?php
function hello($name, $time) {
if($time) {
echo "Hello $name, how are you doing $time?";
} else {
echo "Hello $name, how is it going?";
}
}
hello('Jim', 'this afternoon');
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>
<?php
$flavors = array("Vanilla", "Banana", "Chocolate", "Raspberry", "Strawberry", "Coffe");
?>
<?php echo 'We currently have ' . count($flavors) . ' flavors available. They are:' . "<br>";
?>
<ol>
<?php
foreach ($flavors as $flavor) { ?>
<li> <?php echo $flavor . "<br>"; ?> </li>
<?php } ?>
</ol>
</p>
</body>
</html>