I am making a system that takes all optional subjects from a education and puts it in a database. This works fine.
Now I want to make sure if you choose "Finance A" you can't choose "Finance C", I'm trying to do this with preg_replace as the subject is a array. But it keeps giving me an error:
Delimiter must not be alphanumeric or backslash
Now here is some of the code:
if
(
preg_replace("/" + $name_without_level + " (A|B|C)/", "", $andre_fag)
== $andre_fag
|| preg_replace("/" + $name_without_level + " (A|B|C)/", "", $andre_fag2)
== $andre_fag2
){
The variable $name_without_level gives the Subject name without A, B or C, the Level.
How to fix the error? I have tried everything I can think of.
$name_without_levelis./in your variable, that pcre error wouldn't match.