syntax check

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

php do not need compile like Java or C++, anyway to know any syntax
error or code problem  before actually run the PHP by make a request
to the PHP page?

In Java, you need to compile and fix all error before run it

In php, anyway to fix all error before running it?

Re: syntax check

Quoted text here. Click to load it

In /etc/php.ini on the test server, use:

display_errors = On

and run the php scripts, taking note of the displayed errors and modifying
the php code accordingly. When the errors are gone, then the code is ready
to be moved to your production server where

display_errors = Off

Re: syntax check

On Tue, 4 May 2010 10:21:04 -0700, "Greg Russell"

Quoted text here. Click to load it

In Eclipse or PHPED .. or other PHP IDE, anyway to have the syntax
check before running it on Linux?

Re: syntax check

Carl Forsman wrote:
Quoted text here. Click to load it

No, this is a scripting language - not a compiled language.  No editor
or IDE is going to parse the script (although some do syntax
highlighting - which is entirely different).

But no matter what you're programming in - even just plain HTML- you
should ALWAYS have a development system (including web server) to test on.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: syntax check

Quoted text here. Click to load it

I'm not sure what you're after: If you don't want to rely on the
syntax check of an IDE like Eclipse, you can run your script
through "php -l" before putting it live. It doesn't even have to
be in the right directory.


Re: syntax check

Carl Forsman avait prétendu :

Quoted text here. Click to load it

I don't know about Eclipse, but Netbeans has syntax check for php, and  
code completion.


Re: syntax check

.oO(Carl Forsman)

Quoted text here. Click to load it

Eclipse/PDT checks the syntax and indicates problems.


Re: syntax check

El 04/05/2010 19:06, Carl Forsman escribió/wrote:
Quoted text here. Click to load it

You can run a syntax check with the command line interpreter:

C:\>php -h
   -l               Syntax check only (lint)


C:\>php -l test.php
No syntax errors detected in test.php

It should not be difficult to create a custom tool in your text editor.

(Some IDEs run such check in the background and warn you about syntax
errors with red underline.)

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Site Timeline