php - Fatal error: Can't use function return value in write context in -
i have code check if isset
mysql
data , check int :
<input type="radio" name="lang" value="1" <?php if(isset(filter_var($__sql__[0]['lang'], filter_validate_int))){ echo ($__sql__[0]['lang'] == 1 ? ' checked="checked"' : '');}?> />
but see error:
fatal error: can't use function return value in write context in c:\xampp\htdocs\user\modules\editnews.php on line 56
how can fix error?
it's limitation of php. using isset()
, not function, language construct. can use on simple variables, in php versions prior 5.5. see documentation:
prior php 5.5,
empty()
supports variables; else result in parse error. in other words, following not work:empty(trim($name))
. instead, usetrim($name) == false
.
that means need this:
// we'll check if $__sql__[0]['lang'] exists , // filter_var succeeds. if (isset($__sql__[0]['lang']) && filter_var($__sql__[0]['lang'], filter_validate_int) !== false) { echo ($__sql__[0]['lang'] == 1 ? ' checked="checked"' : ""); }
Comments
Post a Comment