8 – Return multiple values ​​from the custom view field

I have created custom view fields that calculate a percentage and a number based on the referencing of the nodes to the current element. So, on 10 nodes, 5 of them refer to this element.

So the output will be 50%, I also have a field that outputs the numbers so 5/10.

These two fields have the same calculation, so to make it slimmer, I want to try to extract both values ​​from a custom view field. Is there a way to do this. So instead of two fields:

{} Custom_score_precentage
{} Numéro_score_personne

I want a field with two outputs:

{} Custom_score.precentage
{} Custom_score.number

At the moment, I'm using the following text in return a function:

return $ percentage;


return $ number;

I have tried something like:

                $ result = [
        'precentage' => $percentage,
        'number' => $number,
return $ result;

But the options I want do not appear in alternate view templates. How can I do this?