示例#1
0
    var $last_name = array('Silva', 'Santos', 'Oliveira', 'Shultz', 'Cordeiro');
    var $titles = array('Coronel', 'Doutor', 'Desembargador', 'Brigadeiro');
    function generate_number()
    {
        return mt_rand(0, 1000);
    }
    function generate_name()
    {
        shuffle($this->first_name);
        shuffle($this->last_name);
        $indice_fn = mt_rand(0, count($this->first_name) - 1);
        $indice_ln = mt_rand(0, count($this->last_name) - 1);
        return $this->first_name[$indice_fn] . ' ' . $this->last_name[$indice_ln];
    }
    function generate_address()
    {
        shuffle($this->titles);
        shuffle($this->first_name);
        shuffle($this->last_name);
        $indice_fn = mt_rand(0, count($this->first_name) - 1);
        $indice_ln = mt_rand(0, count($this->last_name) - 1);
        $indice_tt = mt_rand(0, count($this->titles) - 1);
        return $this->titles[$indice_tt] . ' ' . $this->first_name[$indice_fn] . ' ' . $this->last_name[$indice_ln];
    }
}
$stub = new Stub();
echo $stub->generate_name();
echo ' - ';
echo $stub->generate_address();
echo ', ';
echo $stub->generate_number();