Symfony - How can I get the String from the following array?

Viewed 17

The query returns the following array and when I add it to the Select it shows me the indexes of the array

 array(1) { [0]=> string(6) "extra1" }

for that runs through the query to retrieve the strings

for($i = 0; $i < count($extras); ++$i){
          $extra[$i] = $extras[$i]['extra'];
    }

add the array to the form select

 ->add('extra', ChoiceType::class, [
                    'choices'  => $extra,
                ])

and with this array what it does is to group them together

array(2) { [0]=> array(1) { ["Jardines"]=> int(1) } [1]=> array(1) { ["Parque"]=> int(2) } } 

for that runs through the query to retrieve the strings

for($i = 0; $i < count($servicios); ++$i){
            $serv[$i] = [$servicios[$i]['nombre'] => $servicios[$i]['idservicio']];
        }

adding in the form is the same

how can I make it so that I only get the text? thanks

0 Answers
Related