Passar Parâmetro Por Referência
#1
Posted 30/03/2010, 19:24
Valew!
#2
Posted 30/03/2010, 19:44
mostre seu código, por favor?
Obrigado. Um abraço.
#3
Posted 31/03/2010, 01:42
Referência
Mais o que interessa é essa parte:
Actually there is a way to give a default value to a reference argument, if you need it badly.
It fires a warning, but you can prefix the function call with an @.
Of course, you cannot pass literals by reference.
<?php
function byref( &$ref )
{
if( !isset( $ref ) )
$ref = "default value";
print $ref; // default or given value? who knows!
}
$hi = "some value ";
byref( $hi ); // works fine
@byref(); // missing argument warning, but works
byref( "hey!" ); // this will raise a fatal error
?>
Sempre que você coloca "@" na frente ele não mostra os warning....
Exemplo:
Se você starta uma session duas vezes ele dá um warning pois a session já foi criada...
Então quando tiver dúvida você pode colocar assim @session_start();
Que ele não vai apresentar o warning...
?
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)