My PHP knowledge is almost zero, my host switched to PHP7, now my online PHP script returns the following error:
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
Here is the piece of code which returns error:
if ($_FILES['image']['name']){
for ($i = 0; $i < count($_FILES['image']['name']); $i++){
$ext = end($ext = explode('.', $_FILES['image']['name'][$i]));
$type = end($type = explode('/', $_FILES['image']['type'][$i]));
$image = preg_replace('/(.*?).'.$ext.'$/ie', "totranslit('\\1')", $_FILES['image']['name'][$i]).'.'.$ext;
This piece of code is for upload of image to site.
I don’g know how to change preg_replace()
to preg_replace_callback()
in this context. Need the exact code.
Thanks for any help.