本文整理汇总了PHP中Persona::inicializar方法的典型用法代码示例。如果您正苦于以下问题:PHP Persona::inicializar方法的具体用法?PHP Persona::inicializar怎么用?PHP Persona::inicializar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Persona
的用法示例。
在下文中一共展示了Persona::inicializar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: imprimir
{
$this->nombre = $nom;
}
public function imprimir()
{
echo $this->nombre;
echo '<br>';
}
}
$per1 = new Persona();
$per1->inicializar('Juan');
$per1->imprimir();
?>
<?php
$per2 = new Persona();
$per2->inicializar('ana');
$per2->imprimir();
class Menu
{
private $enlaces = array();
private $titulos = array();
public function cargarOpcion($en, $tit)
{
$this->enlaces[] = $en;
$this->titulos[] = $tit;
}
public function mostrar()
{
for ($f = 0; $f < count($this->enlaces); $f++) {
echo '<a href="' . $this->enlaces[$f] . '">' . $this->titulos[$f] . '</a>';
echo "-";
示例2: inicializar
<?php
class Persona
{
private $nombre;
public function inicializar($nom)
{
$this->nombre = $nom;
}
public function imprimir()
{
echo $this->nombre;
echo '<br>';
}
}
$per1 = new Persona();
$per1->inicializar('Juan');
$per1->imprimir();
$per2 = new Persona();
$per2->inicializar('Ana');
$per2->imprimir();
示例3: inicializar
<?php
/**
*
*/
class Persona
{
private $nombre;
public function inicializar($nom)
{
$this->nombre = $nombre;
}
public function imprimir()
{
echo $this->nombre;
echo "<br />";
}
}
//Anem a gastar la clase
$per1 = new Persona();
$per1->inicializar("Lucia");
$per1->imprimir();
示例4: inicializar
<?php
/**
*
*/
class Persona
{
private $nombre;
public function inicializar($nom)
{
$this->nombre = $nom;
}
public function imprimir()
{
echo $this->nombre;
echo "<br />";
}
}
//Anem a gastar la clase
$per1 = new Persona();
$per1->inicializar("Alex");
$per1->imprimir();
?>