Instantiate class by calling the constructor : Constructor « Class « PHP
- PHP
- Class
- Constructor
Instantiate class by calling the constructor
<?php
class Staff
{
private $ein;
function __construct($ein)
{
if ($this->verify_ein($ein)) {
echo "called";
}
}
protected function verify_ein($ein)
{
return TRUE;
}
}
$employee = new Staff("123");
?>
Related examples in the same category