the $pizza_data in the pizza_data() function only has local scope to that function so when you return it you need to effectively have a place for that returned data to go, like a variable on the other side of the = from the function

btw in the second set of examples you give its returning the output to a print function

so it sends the functions result directly to be printed, you on the other hand are just calling the function and returning its result to nothingness