Why can't I assign a variable inside of isset? - php

isset, php

Solution

`isset` is a language construct and not a true function. It is mentioned in the docs:

Warning

isset() only works with variables as passing anything else will result in a parse error. For checking if constants are set use the defined() function.

Problem

Recently, I've attempted to be tricky and assign a variable inside of an isset function. I tried to do it like so ``` if(isset($accountid =$_POST['Recipient'])) { // my code here ... } ``` However, when I do this I receive the error ``` syntax error, unexpected '=', expecting ',' or ')' ``` Here is the documentation for isset if you want to reference it in your answer. `bool isset ( mixed $var [, mixed $... ] )` This isn't the hugest deal - but I'd be interested to know why I can't do something along those lines!

Original source