[wp-hackers] Version Compare?

Computer Guru computerguru at neosmart.net
Sun Jul 30 15:17:14 GMT 2006


> var_dump(version_compare('2.1-beta1', '2.1-alpha2', 'gt'));

Works like a dream - I didn't know it was valid for text too.
Thanks!
(But I don't see the need for var_dump... is there a special reason you put
it there? I just have version_compare thrown in an if statement)

Computer Guru
NeoSmart Technologies
http://neosmart.net/blog/


> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-
> bounces at lists.automattic.com] On Behalf Of Rob Miller
> Sent: Sunday, July 30, 2006 6:08 PM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] Version Compare?
> 
> Computer Guru wrote:
> > For the update script I'm looking for a way to compare version
> numbers
> > - but they're not numbers.
> >
> > echo bloginfo('version')
> >
> > returns 2.1-alpha2
> >
> > Which I _can't_ compare to 2.1-beta1 and get the right answer.
> >
> > Is there a hack for this?
> >
> > Computer Guru
> > NeoSmart Technologies
> > http://neosmart.net/blog/
> >
> >
> >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> >
> http://php.net/version_compare
> 
//
> bool(true)
> 
> --
> Rob Miller
> http://robm.me.uk/ | http://kantian.co.uk/
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list