3

I would like to ask you how can we activate check syntax on PHP file?

Because after searching on Google, we need to set user settings by adding:

 "php.validate.executablePath":"C:/wamp/bin/php/php5.3.10/php.exe"

But after testing a simple code with error, there is no signal

VS check syntax:
VS check syntax

Do you know how to fix it?

3
  • You should provide a minimal reproducible example in the question itself and not just a picture of code. Commented Oct 15, 2018 at 12:39
  • 2
    The message says that no problems were detected. Why do you think problems should be detected? The code compiles when I test it. Commented Oct 15, 2018 at 12:40
  • Does this answer your question? PHP Intellisense in Visual Studio Code Commented Nov 10, 2020 at 18:41

1 Answer 1

0

There are no errors in your code example. From the manual:

As in C or Perl, PHP requires instructions to be terminated with a semicolon at the end of each statement. The closing tag of a block of PHP code automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a PHP block.

This

<?php 
echo 'test'
?>

is semantically equivalent to

<?php 
echo 'test'
;?>

So In PHP semicolon is multiple statements separator (a little bit different interpretation than in C)

EDIT

If you want to test error checking in Visual Studio - put a second echo statement, like :

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.