Convert object output to string

Please can anyone help, I’m trying to output a single item from a structure using a foreach loop and this outputs correctly (visually) but if I try to make a variable from it to store in an array, I get:

Array ( [0] => Kirby\Content\Field Object ( [a_code] => CODE01 ) 
not
Array ( [0] => CODE01 ) 
foreach ($shows as $show) {
$value = $show->a_code();
etc...

Is there any way of stripping this out? Thanks for any help.

Sorry, could you please provide more context? What does your structure look like? What is $shows?

This here returns a field object, you need to convert it to whatever you need here, if its just a string, then $show->a_code()->value().

Thank you so much, that’s perfect! I knew there would be a simple thing I was missing.