Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is class same as function?

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
Can i use a class the same as i use a function in php?

something like this:

______________
include "file-with-class.php";
$cost = 6;

str_class(); // in class file: global $cost; $cost = $cost.".00";

echo $cost; // 6.00
_________
this is only an example, not what i need it for ;)

thanks, I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
To use the functions contained in a class, you first have to create an instance of the class (or use [tt]class_name::function_name[/tt]). //Daniel
 
ok so i have a class and inside are functions.

if i want to use these functions do i just have to call the function name, or first the class name and then the function? I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
ow, now iv got it :) thanks I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top