PHP: space between function name and parenthesis

I am wondering if this is legal:

<?php is_null ( $var ); 

Or perhaps this:

 <?php $items = array ( "Details" => array('controller' => 'event', 'action' => 'readall', 'tab' => 'details'), "Calendar" => array('controller' => 'event', 'action' => 'readall', 'tab' => 'calendar') ); 

Or will some translators suffocate?

I know that the popular mixed style of classes and functions has an open curly figure on a new line and control structures such as "if" in one line. However, I like all this or that. New line or new line. It would be nice to extend the concept to function calls and their brackets. This is the reason for my question.

+4
source share
3 answers

It is very legal. And in the end, there are not many translators. :) I also put brackets on the next line if I have a large number of parameters or a large array declaration.

+1
source

It is legal. the interpreter should simply ignore any whitespace found.

+2
source

Space does not matter. The only time I know that the interpreter cares about spaces is when you exit the HEREDOC syntax. Other than that, you can have as many spaces or lines as you want.

+1
source

Source: https://habr.com/ru/post/1336566/


All Articles