With that version of the function, the only difference is that you are storing the result of the ternary expression in $text for a few microseconds, and then returning it to whatever called the function. My version was simply cutting out the middle-man (storing it in the $text variable) and instead immediately returning it. From a functional standpoint there is no difference. From a performance standpoint there may be a very small savings using my version, as there is one less line of source code to parse and one less step (saving the value temporarily in the variable) of actual run-time processing. No big deal with modern processors, just not really necessary.
Think of it as the difference in these two examples:
<?php
echo "Hello, World!";
<?php
$text = "Hello, World!";
echo $text;
Unless you are going to do something else with the $text variable in the 2nd example, then assigning the string to it before echoing it is redundant. The same is true with assigning a value to a variable in a function and then returning that variable: if you are not going to do anything else with that variable, then there's really no reason for the extra processing. However, if (especially in more complex code) you find doing so makes it easier to read and maintain that code, then by all means do so (unless saving microseconds is critical to your application -- in which case you probably should be coding in some fully compiled language anyway).