2
Hey, guys, which of these ways is best to list the bank records? The first is the structured way and the second is the object oriented is not? Thanks.
First:
$sql = $usuario -> listar();
foreach($sql AS $registro)
{
echo $registro['nome'];
}
According to:
$sql = $usuario -> listar();
foreach($sql AS $registro)
{
$usuario -> setNome($registro['nome']);
echo $usuario -> getNome();
}
No context doesn’t get any better. And in PHP, the functions and methods that have the 2 syntaxes are equivalent (and can be mixed in the same chunk of code, including). In fact, in PHP object orientation is irrelevant, and does not add significant functionality. Everything can be done in any of the 2 paradigms.
– Bacco
1) I don’t understand the second example, you use
setNome
and thengetNome
, I don’t see the point in that - unless there’s another context. 2) I think your doubt is more related to DAO that POO.– Papa Charlie