Weird PHP error: 'Can't use function return value in write context'
This also happens when using empty on a function return:
!empty(trim($someText)) and doSomething()
because empty is not a function but a language construct (not sure), and it only takes variables:
Right:
empty($someVar)
Wrong:
empty(someFunc())
Since PHP 5.5, it supports more than variables. But if you need it before 5.5, use trim($name) == false
. From empty documentation.
You mean
if (isset($_POST['sms_code']) == TRUE ) {
though incidentally you really mean
if (isset($_POST['sms_code'])) {
if (isset($_POST('sms_code') == TRUE ) {
change this line to
if (isset($_POST['sms_code']) == TRUE ) {
You are using parentheseis () for $_POST
but you wanted square brackets []
:)
OR
if (isset($_POST['sms_code']) && $_POST['sms_code']) {
//this lets in this block only if $_POST['sms_code'] has some value