Home » Messageboard »
XXX » Message 707881
(Thread)
What's mindpiss?
I've ...
... oh, fucksocks
(
gfreeman is only here for the beer,
Wed 22 Jan 2003, 22:14,
archived)
THREADJACK!
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?
(
sprinkles ITS AN ISLAND, morron,
Wed 22 Jan 2003, 22:15,
archived)
Can you (MOD 10) in php?
(
gfreeman is only here for the beer,
Wed 22 Jan 2003, 22:18,
archived)
well
$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 :)]
(
slight yoinks!,
Wed 22 Jan 2003, 22:18,
archived)
actually...
dur...
$n=4;
$string = "blahblah4";
if( $string{strlen($string)+1} = $n ){
//do summat
}
that'll be a bit more efficient
(
slight yoinks!,
Wed 22 Jan 2003, 22:29,
archived)
if you've
got an integer, isn't it easier to just use mod 10 instead of doing complex string thingies with it?
(
freshlegs,
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
(
slight yoinks!,
Wed 22 Jan 2003, 22:45,
archived)
Double thread jack
FLIBZ!
Its broken!
(
Bud Muhnquai Update your profile or fuck off,
Wed 22 Jan 2003, 22:18,
archived)
database is full
but it won't let me delete any messages...
(
the triple legendary unicorn,
Wed 22 Jan 2003, 22:19,
archived)
I just logged out
and calmly walked away.
(
Bud Muhnquai Update your profile or fuck off,
Wed 22 Jan 2003, 22:24,
archived)
it might be okay now
i don't know.
(
the triple legendary unicorn,
Wed 22 Jan 2003, 22:32,
archived)
why not just
use mod? e.g. does 21 end in 1? 21 mod 10 = 1.
(
freshlegs,
Wed 22 Jan 2003, 22:18,
archived)
I dont
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
(
sprinkles ITS AN ISLAND, morron,
Wed 22 Jan 2003, 22:21,
archived)
.
ask us another one! gwaan!
(
slight yoinks!,
Wed 22 Jan 2003, 22:35,
archived)
.
//checking to see if number ends with a 3
if (ereg ('^*3$', $numberstring)) {
//do something
} else {
//do something else!
}
(
dogbomb,
Wed 22 Jan 2003, 22:23,
archived)
and...
if( number % 10 == 3 )
{
//it does
}
else
{
// it doesn't
}
(
bloid ....dloibbloiddloibbloid....,
Wed 22 Jan 2003, 22:30,
archived)
so
do i just replace the 3s with 0s to check if it ends in a 0
(
sprinkles ITS AN ISLAND, morron,
Wed 22 Jan 2003, 22:32,
archived)
nah
you want mine ;p
(
slight yoinks!,
Wed 22 Jan 2003, 22:36,
archived)
HAhahahaha
Well done sir, my first out loud laugh tonight.
Ta muchness
(
Dr Spam,
Wed 22 Jan 2003, 22:15,
archived)
Hide
If you want to unhide this post later, click the "update profile" link in the top navigation bar, and scroll down to the bottom.
Ignore
You will be blisfully unaware of this user for just one week
You will not see this users messages again
You will not see them and they will not see you