When calling methods, it says: "method not found". What could be the error?

<?php class c_string { public function __construct() { $this->content=""; } public function append($_content) { $this->content.=$_content; } }; class InstallForm extends c_string { public function __construct() { //$text.append("<table>"); $this->text="<table>"; //$content.append(""); //$content.append("</table>"); } function addElem($field_caption,$input_type,$input_value,$input_name) { //$text.append("<tr><td>$field_caption:</td><td><input type=\"$input_type\" value=\"$input_value\" name=\"$input_name\"></td></tr>"); $this->text.=("<tr><td>$field_caption:</td><td><input type=\"$input_type\" value=\"$input_value\" name=\"$input_name\"></td></tr>"); } public function End() { $this->text.=("</table>"); return $this->text; } }; $tmp = new InstallForm(); $tmp.addElem("sadsa","text","sdfdsf","test1"); $tmp.addElem("sadsa","text","sdfdsf","test1"); $tmp.addElem("sadsa","text","sdfdsf","test1"); echo $tmp.End(); ?> 

    2 answers 2

    In PHP, you should:

     $tmp = new InstallForm(); $tmp->addElem("sadsa","text","sdfdsf","test1"); $tmp->addElem("sadsa","text","sdfdsf","test1"); $tmp->addElem("sadsa","text","sdfdsf","test1"); echo $tmp->End(); 

    The object model looks like Java, but the syntax is different.

    • thank;;;;; - PaulD
     $tmp = new InstallForm(); $tmp->addElem("sadsa","text","sdfdsf","test1"); $tmp->addElem("sadsa","text","sdfdsf","test1"); $tmp->addElem("sadsa","text","sdfdsf","test1"); echo $tmp->End(); 

    Calling wrong. And yet, I didn’t see that at the end of the class they put; although it also works that way.

    • thank. it came to me from the pros. - PaulD