I got just a test pattern here, but it does disallow spaces.
$myarray[]='s s';
if (preg_match('/[^\d\w\(\)\[\]\.\-]+/',$myarray)>0) echo 'yes';
This does nothing, but
$test='s s';
if (preg_match('/[^\d\w\(\)\[\]\.\-]+/',$test)>0) echo 'yes';
This works fine…
I dont understand why it doesn’t work with my array?
preg_match doesn’t accept an array as input, just a single string. You’d need to do something like…
To do it in one step: