WordPress从the_views发布视图作为变量

I am using the WordPress plugin WP-PostViews to display the number of views a post has. I am using this code and it works great:

<?php if(function_exists('the_views')) { the_views(); }?>

The thing I want to do is to use this number of post views as a variable but I can't get it working. So far I have tried:

<?php if(function_exists('the_views')) { $variable = the_views(); } ?>

and

<?php if(function_exists('the_views')) { $variable = the_views(); } else { $var = 0; } ?>

No success so far. Does anyone have suggestions?

By default the_views() echos instead of returns. You can get a return by setting the first argument to false. Example:

<?php if(function_exists('the_views')) { $variable = the_views(false); } ?>