I have noticed in php,
<?php
require_once( 'page_elements.php' );
?>
OR you can write it as
<?php
require_once 'page_elements.php';
?>
is there a different in these ? is it really function or is it a language keyword ? Also is there any performance/or any difference in these two syntax ?
both are identical, they may be a minor (to the point of undetectable) speed decrease by using the brackets.
The brackets are really part of the string expression (and are fairly pointless. )
require_once
is a "language construct", essentially a keyword if you will. The parentheses make no difference whatsoever; actually, they belong more to the string than to the require_once
. You can put any expression into as many parentheses as you want:
foo((((1 + 2) + 3)));
Unless it influences operator precedence, the parentheses have no effect whatsoever.
See the manual: http://php.net/manual/en/function.include.php
require_once is a php statement and while using statements we must avoid (). whenever we use require_once '...';
or include_once '...';
statements, these are directly go for require('...')
and include('...')
respectively. Take another reference of return statement.
return $i;
return($i);
there is no difference between these two lines if we are talking about the output. But we don't use braces with return.