Answer the question
In order to leave comments, you need to log in
What's the easiest way to write stripping spaces, tags, and converting to lowercase?
Hello!
There is a code:
$pin = strtolower($_POST['crankpin-1'].$_POST['crankpin-2'].$_POST['crankpin-3'].$_POST['crankpin-4']);
$arr = str_replace('/\s/','',str_split($pin));
echo '<pre>';
print_r($arr);
echo '</pre>';
Answer the question
In order to leave comments, you need to log in
firstly, the cryptic string c $arr = str_replace('/\s/','',str_split($pin));
will work very ambiguously, if only because str_split() does not support multibyte encodings. Secondly, of course, it is not needed there, since str_replace () works with strings in the third argument, but it does not work with regular expressions in the first, so this line does not work for you at all. Otherwise, everything is quite in the best traditions of delusion generators.
Briefly: If you have fields of certain types, check them separately for matching the required types, there are filters and helpers for this. Saving on letters was relevant in the 17th century, when paper was expensive.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question