I saw some code as below
$row [0] ['hello'];
or how
$this->function ('abc');
Does the space after each line or variable eliminate good coding practice or can cause any problem somewhere?
For readers only. The parser does not care, except for the inner lines. This will give different results:
$array = array(3); echo "$array [0]\n"; echo "$array[0]\n";
The results will look something like this:
Array [0] 3
I prefer less free space at a distance from each other, but in most cases there seems to be no error. But, in my opinion, $this->function('abc');it looks better than$this->function ('abc');
$this->function('abc');
, . , Ruby Python, . , , , . . , JSON. . , -.
I think you should use the accepted psr-2 standard .From the terminal, you can use phpcs to test your script:phpcs --standard=PSR2 file.php
phpcs --standard=PSR2 file.php