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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -