[wp-hackers] Version Compare?

Rob Miller r at robm.me.uk
Sun Jul 30 15:07:40 GMT 2006


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

var_dump(version_compare('2.1-beta1', '2.1-alpha2', 'gt')); // bool(true)

-- 
Rob Miller
http://robm.me.uk/ | http://kantian.co.uk/



More information about the wp-hackers mailing list