Hi,
I am going to implement the Oops conecpt in php .So i written the below program it did not printing the values.Can any one say why this value is not printing .

class simpleclass{
		echo "Hai how are you i am fine";		
		
	}

Thank you,

With Regards,
Premnath.M

Recommended Answers

All 3 Replies

No, you need some code like this to do hello world

<?php
class SimpleClass {
    
    function text() {
        echo "Hello World";
    }
}

$mytext = new SimpleClass();
echo $mytext->text();
?>

hi ,
Is it possible to display the values inside the class alone.If not why?

Thanks

Member Avatar for diafol

Have you got a tutorial on OOP? Better still buy a book. Not giving you the brush off, but you could find this info from a basic php tutorial.

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.