does anyone know php? is there any way i can check to see if a number inputted into a form ends in a certain digit?
(,
Wed 22 Jan 2003, 22:15,
archived)
$string = "something ending in 3"
$n = 3;
if( preg_match( "/".$n."$/", $string ){
//do something
}
ought to do it[edit: but im sure there's a more efficient way... i just can't be arsed to think, sorry :)]
(,
Wed 22 Jan 2003, 22:18,
archived)
$n = 3;
if( preg_match( "/".$n."$/", $string ){
//do something
}
ought to do it[edit: but im sure there's a more efficient way... i just can't be arsed to think, sorry :)]
dur...
$n=4;
$string = "blahblah4";
if( $string{strlen($string)+1} = $n ){
//do summat
}
that'll be a bit more efficient
(,
Wed 22 Jan 2003, 22:29,
archived)
$n=4;
$string = "blahblah4";
if( $string{strlen($string)+1} = $n ){
//do summat
}
that'll be a bit more efficient
got an integer, isn't it easier to just use mod 10 instead of doing complex string thingies with it?
(,
Wed 22 Jan 2003, 22:32,
archived)
it's liable to go *POOF* when some little turd types in "uraguay"
yes yes i know, validation... but i suspect this is a quick and dirty
(,
Wed 22 Jan 2003, 22:45,
archived)
yes yes i know, validation... but i suspect this is a quick and dirty
know php - i was just wondring if a lot of people cud post answers and i could stick it together and call it a script :D
(,
Wed 22 Jan 2003, 22:21,
archived)