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?

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • You should provide a [mcve] *in the question itself* and not just a [picture of code](http://idownvotedbecau.se/imageofcode). – Quentin Oct 15 '18 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. – Quentin Oct 15 '18 at 12:40
  • Does this answer your question? [PHP Intellisense in Visual Studio Code](https://stackoverflow.com/questions/52013743/php-intellisense-in-visual-studio-code) – Dharman Nov 10 '20 at 18:41

1 Answers1

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

Agnius Vasiliauskas
  • 10,935
  • 5
  • 50
  • 70