Beispiel #1
0
    //converte objetos para array e remove nao inteiros
    for ($i = 0; $i < count($array1); $i++) {
        if (!is_array($array1[$i])) {
            $array1[$i] = array(key($array1[$i]) => $array1[$i]->n);
        }
        if (!is_numeric($array1[$i]['n'])) {
            unset($array1[$i]);
        }
    }
    return array_values($array1);
}
/*
*  	Ordena array (bubble sort)
*/
function ordenaArray($array)
{
    $array_size = count($array);
    for ($i = 0; $i < $array_size; $i++) {
        for ($j = 0; $j < $array_size; $j++) {
            if ($array[$i] <= $array[$j]) {
                $aux = $array[$i];
                $array[$i] = $array[$j];
                $array[$j] = $aux;
            }
        }
    }
    return $array;
}
echo "<pre>";
var_dump(ordenaArray(juntaInteirosArray($arrObj, $arrArr)));
Beispiel #2
0
  		</div>
  	</div>
  	
   <table class="table table-condensed">
	 <tr>
	 	<td>#</td>
	 	<td>Nome</td>
	 	<td>Tipo Cliente</td>
	 	<td>Classificação</td>

	 	<td>Visualizar</td>
	 	
	 </tr>
	<?php 
foreach (ordenaArray($arrayClientes) as $key => $val) {
    ?>
	 <tr>
	 	<td><?php 
    echo $val->getId();
    ?>
</td>
	 	<td><?php 
    echo $val->getNome();
    ?>
</td>
	 	<td><?php 
    echo $val instanceof PessoaFisica ? 'PF' : 'PJ';
    ?>
</td>
	 	<td><?php