php code with + symbol issue
Posted: Fri Jan 23, 2009 6:01 am
hi all..i need some help with php code
i've have this code
and try it with
1)$Valstring='hulu'; and its return $ValResult=1--ok
2)$Valstring='hulu-'; and its return $ValResult=1--ok
3)$Valstring='hulu123'; and its return $ValResult=0--ok
4)$Valstring='hulu]'; and its return $ValResult=0--ok
but the when i try it with
5)$Valstring='hulu+'; and its return $ValResult=1--not ok
it suppose to return $ValResult=0
can someone help me with..thanking you all in advance for reviewing my post
i've have this code
Code: Select all
$ValResult=0;
preg_match_all('/^[a-zA-Z- .,]{2,200}$/', $Valstring, $matches);
foreach($matches[0] as $value){
if($value!='' || $value!='0' || $value!='null'){
$ValResult=1;
}
else{
$ValResult=0;
}
}
return $ValResult;
1)$Valstring='hulu'; and its return $ValResult=1--ok
2)$Valstring='hulu-'; and its return $ValResult=1--ok
3)$Valstring='hulu123'; and its return $ValResult=0--ok
4)$Valstring='hulu]'; and its return $ValResult=0--ok
but the when i try it with
5)$Valstring='hulu+'; and its return $ValResult=1--not ok
it suppose to return $ValResult=0
can someone help me with..thanking you all in advance for reviewing my post