Using a space after each line in a variable causes any problem

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?

+4
source share
4 answers

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
0
source

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');

0
source

, . , Ruby Python, . , , , . . , JSON. . , -.

0

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

0
source

All Articles