| | |
PHP Syntax checking
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hello all,
I've been working for awhile building a web with PHP. So far, so good. But I'm finding refactoring to be frustrating, because I haven't found a tool that will give a full syntax check across my code. Yes, there is the "php -l" command to do the lint-style check, but that's a very basic check. I'm thinking of a case where I define
in one file and then call foo() from another file. In the course of refactoring, I change "foo()" to "betterName()". In a compiled language, any reference to foo() that I missed changing would cause a compilation error. Since PHP is interpreted, I only see an error when I load a page that hits the specific line of code with the error. Thus, it's easy to miss an error.
So the question: does anyone know of a tool that will do a real syntax check, even to the level of making sure called functions are actually defined? I've been looking for a while, but I haven't been able to find anything.
Thanks,
Dave.
I've been working for awhile building a web with PHP. So far, so good. But I'm finding refactoring to be frustrating, because I haven't found a tool that will give a full syntax check across my code. Yes, there is the "php -l" command to do the lint-style check, but that's a very basic check. I'm thinking of a case where I define
PHP Syntax (Toggle Plain Text)
function foo() { ... }
in one file and then call foo() from another file. In the course of refactoring, I change "foo()" to "betterName()". In a compiled language, any reference to foo() that I missed changing would cause a compilation error. Since PHP is interpreted, I only see an error when I load a page that hits the specific line of code with the error. Thus, it's easy to miss an error.
So the question: does anyone know of a tool that will do a real syntax check, even to the level of making sure called functions are actually defined? I've been looking for a while, but I haven't been able to find anything.
Thanks,
Dave.
•
•
•
•
php designer does a good job with debugging. Like php, its free to download. It has a code coloring scheme similar to dreamweavers that will help you spot syntax errors and the debug will find errors and tell you what line the error is found on.
Unfortunately, it doesn't run on Mac, so I won't be able to try it out until I get home. (I do most of my work on a Mac laptop.) Since I can't run it, I just took a look at the web site. I see that it does syntax checking, but it looks like it's just the basic syntax checking you can do from the command line with "php -l". I'm using the PHP plugin for Eclipse, which can also do that. I'm looking for a bit more.
a.php:
PHP Syntax (Toggle Plain Text)
function foo() { echo '<p>This is foo()'; }
b.php:
PHP Syntax (Toggle Plain Text)
require_once('a.php'); foo();
I point my browser at b.php, and I'll get some simple output. Now, suppose I edit a.php and change "foo()" to "bar()", but don't change b.php. When I point my browser to b.php, I'll get an undefined function error. I'm looking for a tool that will find that error without me having to view b.php in a browser (because presumably I have lots of pages, and the call might be within some if statements, and I don't want to have to execute every line of code I have to catch the error). Eclipse's plugin doesn't find it, the php command line tool doesn't find it, and looking at http://www.mpsoftware.dk/phpdesigner_features.php, it doesn't look like it will either (one listed feature says "Syntax check PHP using the PHP Interpreter").
I'm thinking of the work I've done in Java, C++, and other compiled languages. If I make a change like this, then the compiler will look at all my code and complain that it can't find foo(). It does the checking for me and gives a list of problems.
Sorry if this is redundant, just trying to be clear.
Thanks again,
Dave.
•
•
•
•
Probably the best debugging in PHP will be in Zend Studio (I use professional) which is cross-platform. There should be a free trial on their site. It does a pretty good job of picking apart your code like a crazy english teacher with a red pen.
Despite the high price tag, I do highly recommend it.
I've been using Firebug for a while and it's a fantastic tool for figuring out problems with JavaScript, CSS, and other client side problems, but it doesn't address what I'm looking for in PHP.
•
•
Join Date: Dec 2007
Posts: 3
Reputation:
Solved Threads: 0
please download PHP designer from www.phazeddl.com and use it. the software will indeed help in debugging PHP and i bet u will like bros
phpDesigner's official site appears to be http://www.mpsoftware.dk/, so I would download it from there. Looking over their web site, I don't see anything that suggests they have the feature I'm looking for. However, since it's not the first time this tool's been suggested, I decided to just write to them and ask. I'll post the answer when I get it.
Dave.
Dave.
![]() |
Similar Threads
- Report w/Cateories/subcategories (PHP)
- Warning: mysql_num_rows(): (PHP)
- Trying to create a login system (PHP)
- Help with Login Box (PHP)
- Please help us to beta-test PHP editor (PHP)
Other Threads in the PHP Forum
- Previous Thread: new to PHP
- Next Thread: recommend a php book
| Thread Tools | Search this Thread |
ajax apache api array beginner binary body broken cakephp checkbox class cms code cookies cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert interactive ip javascript job joomla js limit link login mail mediawiki menu mlm mobile msqli_multi_query multiple mycodeisbad mysql navigation oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion regex remote script search server sessions sms source space sql stored subdomain syntax system table tutorial unicode update upload url validator variable video web webapplications websitecontactform xml youtube





