Hello
I m not clear about class. Can anybody help me. Actually what is different between class and function. When I will use functiona and when I will use function.
arctushar 0 Junior Poster in Training
Recommended Answers
Jump to PostThe PHP Language reference has details on what a function and class is:
http://www.php.net/manual/en/langref.phpIt also explains most the other features of PHP. If want to learn PHP that is the best place …
Jump to PostI don't know if the previous example is that useful:
function Comment($comment,$html=false,$nl2br=false){ if($html)$comment = htmlentities($comment); if($nl2br)$comment = nl2br($comment); return $comment; } //usage: echo Comment($comment,false,true); //will nl2br the comment
class Comment{ private $txt; public function __construct($comment){ $this->txt = $comment; } public function Clean($html=false,$nl2br=false){ if($html)$this->txt = …
Jump to PostOf course you can use plain functions. For reusability's sake classes and methods are usually preferred.
All 10 Replies
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
Zagga commented: You couldn't ask for a fuller explaination. Love it! +2
jkon 689 Posting Whiz in Training Featured Poster
arctushar 0 Junior Poster in Training
jkon 689 Posting Whiz in Training Featured Poster
jkon 689 Posting Whiz in Training Featured Poster
cmps 26 Light Poster
arctushar commented: I like this comment. this more helpful +0

diafol
arctushar 0 Junior Poster in Training
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
fpaquin 0 Newbie Poster
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.