hi Friends
i have problam withe oop
i have class :

class create
{	
function CreateDiv($persian,$author)
{

$div="<div align=\"right\" dir=\"rtl\">"
. "<p style=\"font: 12px Tahoma; direction: rtl; text-align: right; line-height: 20px;\">"
. "test datebase"

."<font color=\"#0066FF\">$author</font> ".$persian->date('compelete')."<br>"
."</div>";
return (string) $div;
}

}

and sample page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
include('persian_date.class.php');
include('Create_div.php');
$persian=new persian_date();
$author="Coward";
$test=new Create();
$test->CreateDiv($persian,$author);
echo $test;
?>
</body>
</html>

and error

Catchable fatal error: Object of class create could not be converted to string in D:\xampplite\htdocs\web me\create div\sample.php on line 16

and thx ;)

:ooh:

$test1=$test->CreateDiv($persian,$author);
echo $test1;

:P

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.