classes - beginner question
Posted: Thu Jan 31, 2008 7:26 am
hi all,
im a first time php programmer however long time C# / javascript / vb.net / etc programmer so i am fully versed in oop and know how to program (theory, etc).
I am charged with making a rather simple search class in php that uses XPath. I just have some basic questions about classes in php before i get too far along.
1. Are classes in php similar to C# where i can have the class in a separate physical file and include it in another php file, then instantiate it and call its methods just like :
include myclass.php
FTSearch mySearch = new FTSearch() // construct it
var $myArray = mySearch.PerformSearch(blah) //activate a method that returns a string or array
2. also how do i construct a method that returns a value? in C# it would be like :
public string ThisReturnsAString(){
return myString;
}
thats it for now.
thanks in advance,
mcm
im a first time php programmer however long time C# / javascript / vb.net / etc programmer so i am fully versed in oop and know how to program (theory, etc).
I am charged with making a rather simple search class in php that uses XPath. I just have some basic questions about classes in php before i get too far along.
1. Are classes in php similar to C# where i can have the class in a separate physical file and include it in another php file, then instantiate it and call its methods just like :
include myclass.php
FTSearch mySearch = new FTSearch() // construct it
var $myArray = mySearch.PerformSearch(blah) //activate a method that returns a string or array
2. also how do i construct a method that returns a value? in C# it would be like :
public string ThisReturnsAString(){
return myString;
}
thats it for now.
thanks in advance,
mcm