I have following error:
Error type – 2: preg_replace() [function.preg-replace]: Compilation failed: missing ) at offset 25: in /var/www/hosting/com/galerielaboratorio/scripts/functions.php on line 766
Here is the function:
function getThumbName($photo, $name = 'thumb') {
$ext = preg_replace ("/.*\./", "", $photo);
$photo = preg_replace ("/\.". $ext ."$/", "" , $photo). "." . $name . "." .$ext; // this line causes the error
return $photo;
}
Thanks for help in advance.
Cannot read your expression, but you missed one
).()-pairs define expression groups. One(without its corresponding)is just invalid (and thats what the error message tries to tell you). If you want to have a literal(you must escape it\(However, have a look at
pathinfo(),explode()andstr_replace(). This is not a scenario for regular expressions