I have some code like this inside a file script.php:
class ABC
{
public function sampleName() { do something}
}
Now if I run
php script.php
from command line it doesn’t do anything. I thought it would execute the function. Do I have to call the funciton sampleName somewhere inside the file? If so, how do I do this?
After the class ends should I say $this->SampleName()?
instantiate your class -> call function: