I got one project written by Romanian outsourcers for the Germans.
In the following procedure, Romanians check whether the user has given a valid table name for MySQL (the name is entered into the form, a table is created using it).
What does this piece of code do? Determines if there is a space in the string. To do this, Romanian craftsmen determine the length of the string, remove all spaces from the string, determine the length again, and compare two values:
if( strlen( $pName ) != strlen( str_replace(" ", "", $pName) ) ) {
But this was not enough for them. Further in the same procedure, they check the entire line for a digit / letter / underscore:
')
for ($i=0 ; ($i < strlen($pName)) && ($isName) ; $i++ ) { if( !( ctype_alpha( $pName[$i] ) || ctype_digit( $pName[$i] ) || ( $pName[$i] == '_' ) ) ) { $isName = false; } }
And no less successful comparison of the string with the sample, the same project:
if ((strtolower($fmultipledownload) != strtolower("YES")) && (strtolower($fmultipledownload) != strtolower("NO")) ) {