Search code examples
phpexplodeapcstrict

Strict standards not allowing a simple php explode statement?


I'm getting this error:

Strict Standards: Only variables should be passed by reference in /home/mydomain/public_html/printshop/upload_2-img-dpi.php on line 55

These are lines 49 to 56:

if(!is_dir($upload_dir)){
    mkdir($upload_dir, 0777, TRUE);
    chmod($upload_dir, 0777);
}       

    $value = explode(".", $userfile_name); // line 55
    $file_ext = strtolower(array_pop($value)); 

What's wrong? This code was working fine before I got APC installed on my server.


Solution

  • Okay, I did this, and it worked:

        $value = array();
        $value = explode(".", $userfile_name);
        $file_ext = strtolower(end($value)); 
    

    shrug