| Una funzione per il debug in PHP |
|
|
|
| Scritto da Ivan Piffer | ||||||||
| mercoledì 19 dicembre 2007 | ||||||||
|
Un esempio da manuale per l'arte che le poche di righe di codice dimostra; quando vedo queste cose VERAMENTE penso alla genialita' che si puo' dimostrare in IT.
Despite the proliferation of debugging tools, especially real-time debuggers, “debugging by print statement” remains the most common form of debugging in most programming languages. It’s especially important when you run into a fatal error on a production server that you can’t use a real-time debugger on, display_errors is Off, and you can’t take the server down to test something (which is the only place that the most critical bugs appear, according to Murphy). Of course, even if you can hide debug statements throughout the code without the user knowing you still need to know which is which in order to trace code execution. (You wouldn’t believe the number of times I’ve had to do that to deal with weirdly configured servers.) PHP offers __FILE__ and __LINE__ magic constants to show where a given line is executed, and you can always wrap a print statement in a “display:none” div, but that’s a lot of extra code to write or copy to everywhere you just want to know the status of a variable. Many frameworks offer their own debugging framework, but those don’t help if you’re not using that framework. Centralizing that code breaks the __FILE__ and __LINE__ constants. Now what?.... Guardate in codice della funzione nel link dell'articolo!!!
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |
||||||||
| < Prec. | Pros. > |
|---|