Very short trick: avoid error message in PHP

Se non vogliamo che una funzione PHP emetta un qualsiasi errore o warning, basta inserire prima della chiamata alla funzione il carattere chiocciola – o at – (@):

1
2
3
4
// invece di usare la forma canonica
$res = miaFunc();
// è possibile usare
$res = @miaFunc();

Un commento a: “Very short trick: avoid error message in PHP”

  1. 10 ott, 2008 Nicola Ballotta:

    Ho finalmente capito una cosa che mi chiedevo da un po’ di tempo :P

Lascia un commento

TAG XHTML PERMESSI: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERIMENTO CODICE:
<pre></pre> // blocco generico
					<code></code> // blocco generico
					[cc_actionscript][/cc_actionscript] // Actionscript
					[cc_actionscript3][/cc_actionscript3] // Actionscript 3
					[cc_css][/cc_css] // CSS Style Sheet
					[cc_html][/cc_html] // HTML
					[cc_js][/cc_js] // Javascript
					[cc_objc][/cc_objc] // Objective-C
					[cc_php][/cc_objc] // PHP
					[cc_sql][/cc_sql] // SQL


Stop SOPA