-1

I keep getting the following error with this code:

Fatal error: Can't use function return value in write context in /home3/laarrkin/public_html/streamconcerns.com/devwork/login-check.php on line 48

//StringSplitters
$data_a = explode('hp/details">', $data2);
$data_b = explode(', you', $data_a[1]);
$data_c = explode(' [', $data_b[0]);
$data_d = explode(' ', $data_c[0]);
$data_e = explode(']', $data_c[1]);
$data_f = explode('</a></str', $data_d[1]);
$data_g = explode('<td class="period_slot_2">', $data2);
$data_h = explode('<strong>', $data_g[1]);
$data_i = explode('</strong>', $data_h[1]);
//Function
function yearlevel() {
    $str = $data_i[0];
    if (($strlen($str) = 6)) {//Line 48
        $k = str_split($str, 3);
        $k2 = str_split($k[1], 1);
        if ($k2[0] == "1") {
            return "11";
        }
        if ($k2[0] == "2") {
            return "12";
        }
        if ($k2[0] == "3") {
            return "13";
        }
    } else {
        return "10";
    }
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Daniel Larkin
  • 17
  • 1
  • 2
  • what login-check.php on line 48 have? – Zahidul Hossein Ripon Nov 11 '13 at 11:08
  • Did you read similar questions like [Can't use method return value in write context](http://stackoverflow.com/questions/1075534/cant-use-method-return-value-in-write-context)? The answer is obvious if you did even a small amount of searching. – naththedeveloper Nov 11 '13 at 11:08
  • You cannot return multiple values from a function, unless you pass it as an array. If `$k2[0] == "3"`, then your function is trying to return `12` and `13`. – Ben Fortune Nov 11 '13 at 11:11

1 Answers1

0

Check if you are using the php functions empty() or isset(), on login-check.php line 48.

This functions can throw that error.

Edit:

I think line 48, it's going to throw you an error:

It's strlen($str), not $strlen($str).

And check the comparation you are using = not ==, you are trying to assign a value to the return of a function.

Salvador P.
  • 1,469
  • 19
  • 16