Only allow English characters/letters/numbers and a few special characters

<>

This question already has an answer here:

Answers


You may create an array of allowed characters and then filter those that are not allowed:

$allowed = array_merge(range('a', 'z'), range('A', 'Z'), range(0, 9), array(' ', '+', '/', '-', '*', '.')); // Create an array of allowed characters

$string = 'This is allowed and this not é Ó ½ and nothing 123.'; // test string

$array = str_split($string); // split the string (character length = 1)

echo implode('', array_intersect($array, $allowed)); // Filter and implode !

Online demo.


Need Your Help

android tablet UI designing issue

android

I am new to android tablet development. I have few questions regarding resolutions that we need to target.

Infinispan: How to combine embedded cache and standalone server in one cluster?

infinispan jboss-cache

As a proof of concept, I try to build an infinispan cluster with an existing application which starts an embedded cache and one or more standalone infinispan servers.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.