Dylan Little Dylan Little -4 years ago 119
PHP Question

How do I write php in .php file that is rendered to the viewable webpage

I'm trying to write a basic example of php that I want to be viewed on my website. In other words I want the following code to be viewable but I would also like a copy of it to be executable on the webpage:

<body>
<p>
<?php
$food = array("Bananas", "Toast", "Eggs", "Bacon");
echo "I like " . $food[0] . ", " . $food[1] .
" and " . $food[2] . " and " . $food[3] . ".";
?>
</p>
</body>

Answer Source

<?php and ?> makes code inside to execute, use &lt;?php and ?&gt;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download