500 - Internal server error with an extra pair of brackets

I have been looking for an error in my code since an hour. It was a mistake:

Record:

if(isset(($_POST['to'])))

instead

if(isset($_POST['to']))

I do not understand why this extra pair of brackets causes an internal server error.

I do not think that the brackets around a variable will ever change its value. I mean,

$a = $b;
$c = ($b);

$a==$c; //True

I am curious to know why this is a mistake?

Thanks.

EDIT:

The above error also occurred for a normal variable.

+4
source share
4 answers

This is due to the fact that issetit is not a function, but a language construct; as such, its definition can be found in the language parser .

T_ISSET '(' isset_variables ')' { $$ = $3; }

; .

+2

, - , isset . . "" -, .

, isset, :

Can't use method return value in write context
+1

isset:

isset() , - . , , () .

+1

. .

. , , .

The following example has a function with one argument ($ fname). When the familyName () function is called, we also pass a name (for example, Jani), and the name is used inside the function, which displays several different first names, but has the same last name:

<?php
function familyName($fname)
{
echo "$fname Refsnes.<br>";
}

familyName("Jani");
familyName("Hege");
familyName("Stale");
familyName("Kai Jim");
familyName("Borge");
?>
0
source

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


All Articles