Re: What is the best way to debug/test a PHP code ?



Following on from Erwin Moller's message. . .
sudeerao@xxxxxxxxx wrote:

Please let me know how do we effectively and quickly test a php code ?

Short question.
Difficult to answer.

It completely depends on your requirements.
You can judge the code by:
- security (header/email-injection, sql-injection, loginlogic)
- functionality: Does the code produce what you want, also if you feed it
information designed to confuse it.
- Codingstyle: Can a PHP programmer easily read through the code? Does it
have some comments to explain what is going on? If you use a database, is
it designed neat and smart?
- stresstesting: Do you expect a lot a concurent hits, and is the setup on
your machine capable of handling that? (Of course it is up to you to set
the minimum)

etc.

So what is it you want?

I think it is safe to say you need an experienced PHP programmer to judge
any of the above (except the stresstesting maybe).

Regards,
Erwin Moller

Yes. "debug" and "test" are entirely different things.

Debug : Getting rid of reported faults
Exercise : Run all bits of code and show it can be made to work
Test : Look for weaknesses.

If you're wondering how to find out what's going on inside your program when you get a run-time problem then you might simply put in a print_r(), or write a log of function calls, variable watches etc to another file. [My PHP system is off-line at the minute or you could have my debugging library]

FWIW the way to develop Exercise and Test is by making notes as you're building the code: What could possibly go wrong?... Silly arguments...flag this for future investigation to stop interrupting flow of coding thought...is that a [D] for document a [E] for exercise or a [T] for needs testing (or all of them). Then when you're setting out to exercise you look for "[E] comments " in the code and build the exercises accordingly. And so on.

PS Personally I don't care much for black box testing if the white box (stupid name) has been done well.





--
PETER FOX Not the same since the deckchair business folded
peterfox@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
.



Relevant Pages

  • Re: Beethovens influence (Giuliani)
    ... >I went through that exercise some time ago. ... Since you are not qualified to judge the rest, ... loaded the article and use it as an errata list for the Jeffery book. ... It is required reading in all serious university courses on guitar ...
    (rec.music.classical.guitar)
  • Re: Stanleys
    ... we should not judge the folk of the ... past by 21st century standards - it's actually an interesting exercise to ...
    (soc.genealogy.britain)
  • Re: IIgs programmers still going...
    ... You've found the blog, so I'm sure you're up on the latest. ... uploaded a very simple demo to exercise the ToolSet and I'm working on ... fleshing out the full functionality now that the bare-bones ... breaks KEGS on maze demo ...
    (comp.sys.apple2.programmer)
  • Re: Help Using Shift Register
    ... That's a very good exercise to learn about shift registers.  I did a slight improvement to your vi. ... The functionality is unchanged. ...
    (comp.lang.labview)