user1577002
user1577002

Reputation: 1

Strict Standards: Only variables should be passed by reference in

I am trying to work on a forgot password system. I have no clue why I am getting this error, I've rechecked the code almost five times. Any help would be wonderful.

by the way, this is Exception.

Error- Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\core\init.php on line 8

recover.php

echo $current_file = end(explode('/', $_SERVER['SCRIPT_NAME']));

Upvotes: 0

Views: 4049

Answers (2)

Jérôme
Jérôme

Reputation: 616

As explained very well here, the PHP end() method waits for a variable reference to work correctly. What you have to do is simply give a variable reference instead of a plain value.

$var = $_SERVER['SCRIPT_NAME'];
$exploded = explode('/', $var);
$current_file = end($exploded);

Upvotes: 2

Martin-Brennan
Martin-Brennan

Reputation: 927

This error seems to be because you are passing in a value to explode() rather than a variable, try this:

$var = $_SERVER['SCRIPT_NAME'];
$current_file = end(explode('/', $var));

Upvotes: 3

Related Questions