Upload file time show error Strict Standards: Only variables should be passed by reference

MySQL, PHP, Tutorial 0 Comments

How to solve php error while image upload time show error Strict Standards: Only variables should be passed by reference. error show on explode function solve php error while image upload time show error Strict Standards and save image path in mysql

I am face error while image upload and save image path in mysql database in php code.

First I am use this code and show error (Strict Standards: Only variables should be passed by reference)


$extension = end(explode(".", $_FILES["uploadedfile"]["name"]));

And Than I have changed some php code and than no any error show


$allowedExts = array("pdf", "doc", "docx");
$exp = explode(".", $_FILES["uploadedfile"]["name"]);
$extension = end($exp);

You can also used this type Php code


$ext = pathinfo($_FILES["filename"]["name"])['extension'];

only variables should be passed by reference php 7, only variables should be passed by reference codeigniter php mysql, only variables should be passed by reference array_shift
strict standards: only variables should be passed by reference end(explode, strict warning: only variables should be passed by reference
e_notice only variables should be passed by reference, array_map only variables should be passed by reference, only variables should be passed by reference php yii
php mysql