0

Hello i got strange error, normaly it's works on xampp, but when i setup it on host i'ts give me error that Only variables should be passed by reference, but i don't get it why, can you guy's help me please.

$it = new RecursiveDirectoryIterator("./extensions");
foreach(new RecursiveIteratorIterator($it) as $file) {
if (in_array(strtolower(array_pop(explode('.', $file))), array('php'))) {
    include $file;
}
}

Thanks.

  • It may be PHP version related, run `php --version` on both sever and Xamp. – Top-Master Jul 28 '21 at 12:20
  • Any function needing a reference can't use the return from another function - `array_pop` is one of them. – Nigel Ren Jul 28 '21 at 12:23
  • You also might find https://stackoverflow.com/questions/173868/how-do-i-get-a-file-extension-in-php is an alternative (if you are just extracting the file extension). – Nigel Ren Jul 28 '21 at 12:25
  • Thank you both for your help, it was php version issue, Soloved :) Changing to version 7 and up fix this issue. – FleksisLV Jul 29 '21 at 21:55

0 Answers0