Type the following lines and save them as a.php
<html>

<body>
<?
echo "hello world";
?>
</body>
</html>

Recommended Answers

All 3 Replies

Yes, well done. Although that will only work if you have short tags enabled other wise you have to use <?php ?>

If you are using only <? for open PHP code you need to have enabled short open tag in your PHP config file.

Member Avatar for diafol

Yes. In general you should avoid using short tags, including the short form of 'echo' (<?=).

@ ag
Can I ask why you posted this article?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.