Jump to content

[SOLVED] Class Arguments?


Garethp

Recommended Posts

Ok, so I want to make a class where I have global variables that I can set as I call the class. Like this

 

class Something($Text)
{
function T()
{
echo $this->Text;
}
}

$v = new Something('Hello World');
$v->T();

 

I know I could set it with a function, but I'd rather do it with the example above. Can it be done?

Link to comment
https://forums.phpfreaks.com/topic/170792-solved-class-arguments/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.