Very short trick: avoid error message in PHP

mercoledì 8 ottobre, 2008

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 - (@):

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

Post correlati

Questo articolo ti è stato utile?: Per nientePocoAbbastanzaMoltoMoltissimo
Loading ... Loading ...

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
[as][/as]           // Actionscript
[css][/css]         // CSS Style Sheet
[html][/html]       // HTML
[js][/js]           // Javascript
[objc][/objc]       // Objective-C
[php][/php]         // PHP
[sql][/sql]         // SQL