質問

In my code:


$c = preg_replace('#[^a-z0-9áčďéěíňóřšťúůýž_-:().,;!?]#i', '', $_POST['c']);


I get this error:
Warning: preg_replace() [function.preg-replace]: Compilation failed: range out of order in character class at offset 40


IDK where could be the error.

役に立ちましたか?

解決

Do this way:

$c = preg_replace('#[^a-z0-9áčďéěíňóřšťúůýž_\-:().,;!?]#i', '', $_POST['c']);

you need to escape - inside square brackets [..] because it's treated as interval specifier

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top