使用money_format的意外结果

I'm trying to assign the output of a custom wordpress field to $number and then use $number inside money_format. My expected output is £ value_in_number, but I'm actually getting value_in_number £.

Here is my code:

<?php
    $number = the_field( 'amount_raised' ); 
    setLocale(LC_MONETARY, 'en_GB');
    echo money_format('%n', $number) . "
";
?>

If i assign an actual value to $number I get my expected result, but adding the_field( 'amount_raised' ); switches the symbol and value around. amount_raised is a number field.

Any ideas?