Not sure if I'm not seeing something or what, but I have a simple id validation
$id = '2s2';
var_dump($id);
var_dump($id*1);
if ($id != ($id*1) || $id <= 0) {
die('wrong id');
}
die('here?');
The result:
string '2s2' (length=3)
int 2
here?
It checks if id is the same as id multiplied by 1 or if the value is zero or lower. Since, the value of $id = '2s2; it is not the same ( as can be seen in the dump ).
Why is this not echoing wrong id ?
Aucun commentaire:
Enregistrer un commentaire