Hello,
I have a string to check and if it is only numbers and digits perform another action else exit;
$data = 123412347JB91742F;
if(preg_match('/[A-Z1-9]/', $data )) {
echo $data;
}
else {
exit;
}
this works fine but if i add anything to $data like $ or any other thing it still prints the value what is wrong with code?
/////////////////// edit ///////////////
$data = preg_replace('/-/', '', '1234-1234-JB91-8742F');
if(preg_match('/^[A-Z1-9]+$/', $data )) { echo $data; } else { exit; }
Thank You.