Having the following class called Pagina
:
class Pagina
{
public $_nombre = "Bienvido a tu casa";
public static $_url ="tucasa.com";
public function bienvenida()
{
echo $this->_nombre;
echo "URL:".$this->_url;
}
public static function bienvenida2()
{
echo "URL:". self::$_url;
}
}
$pagina= new Pagina();
$pagina->bienvenida2();
This contains an attribute of the static type ( static
) and to access the attributes static
I must use a static method.
My question is:
Is it possible to access the static attribute $_url
, without directly using the variable with the method self::
, ie is there another method where it can be accessed by placing _url
? , or is it only possible using the self::
or in this case Pagina::
?