I have two php files feed.php and main.php.
In main.php, I am using feed.php.
feed.php
class RSSFeed {
var $channel_url;
var $channel_title;
var $channel_description;
var $channel_lang;
};
main.php
<html>
<body>
<?php include 'feed.php'; ?>
<h1>Welcome to my home page!</h1>
<p>Some text.</p>
</body>
</html>
when I run main.php, I got the following output
class RSSFeed {
var $channel_url;
var $channel_title;
var $channel_description;
var $channel_lang;
}
Welcome to my home page!
Some text.
I am not able to understand why I see the contents of RSSFeed class when I display the main.php in browser?
Because you forgot to put
<?phpand?>on feed.php. That file is treated like plain text and is displayed in the HTML.