Forum Moderators: coopster
Does it give you any parse errors?
PHP can only tell you about certain errors.
For example if you put:
$a=11;
When you meant
$a=0;
And for some reason your script jams up, PHP can't tell you it was because $a had the wrong value, you have to manually figure that out yourself.
If you still can't figure it out .zip up the whole script and let me take a look at it, I'll have a look at it and see if I can tell you whats goin wrong.
Besides this, an editor that can show you line numbers and syntax highlighting can get you very far in validation steps. It will show you where strings begin and end, and where they are properly closed or not; good ones will show you where brackets/braces/parentheses are matched, or not. Jedit is what I usually recommend for this kind of thing; HTML-Kit is cool, but over multiple lines of code I've been less than pleased with the syntax highlighting. I also don't use windows much any more really and jedit is available on many different platforms. The editor I actually use most lately is Kate, but that's *nix only, I'm afraid.
There's no such thing as PHP validation per se. Properly speaking, that is a term that pertains to SGML languages and such.
One could say that parsing HTML is a sort of validation as Minck said, but you know your PHP is valid in that respect or you get parse errors and the script crashes.
So, the best things you can do are
- run with E_ALL as Mincklerstraat said in the previous post
- get an editor with brace matching and syntax highlighting. When you find yourself saying "Hey the syntax highlighting for this program is screwed up" it's likely that the program is fine ;-) Some that have it that I know of are Kommodo, HAPEdit, NVU, TextPad, Context and many many others. Please do a google search for it since you'll find very long threads on the subject.
- run a debugger/profiler. There are a few. I sometimes (rarely actually) use xdebug. Kommodo comes packaged with a good one. php-debugger is suposed to be good but I've never gotten it to work. It's supposed to be integrated with one of the free php editors but I don't remember which one.