php - How to echo custom function -


i have function

function getservertitle() {         return($this->_values[$this->_indexes["servertitle"][0]]["value"]);     } 

and wanted echo it, doesn't work.

echo getservertitle(); 

it shows

fatal error: call undefined function getservertitle()  

since body of function contains references $this, not function in older sense of word, non-static method on class.

this implies, way run in meaningfull way instantiate class , call method of resulting object.

e.g.

$object=new your_class_name(); echo $object->getservertitle(); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -