문제

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