1

I have the following code :

    $_SESSION['aParties'] = time();
    $aParties[] = $_SESSION['aParties'];
    error_log(print_r($aParties,true), 3, "/var/tmp/error.log");
    $first = reset(ksort($aParties));

The array aParties is like this :

Array
(
  [0] => 1433841062
)

But I get the error :

'Only variables should be passed by reference in the method ksort' 

Help me please! Thx in advance

TanGio
  • 766
  • 2
  • 12
  • 34

1 Answers1

2

You need to do it as

ksort($aParties);
$first = reset($aParties);

Note: There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference.

Check Docs

Narendrasingh Sisodia
  • 21,247
  • 6
  • 47
  • 54