0

I do not understand why when I echo this:

echo $HotelesDisponibles->Currency;

Results in "Mexican Peso".

But when I add it to an array like this and then print it:

$array_habitaciones["$HotelCode"]["Currency"] = $HotelesDisponibles->Currency;

It prints this:

[19243] => Array
    (

        [Currency] => SimpleXMLElement Object
            (
                [@attributes] => Array
                    (
                        [code] => MXN
                    )

                [0] => Mexican Peso
            )
      )

How can I transform it to:

[19243] => Array
    (

        [Currency] => Mexican Peso


    )

Greetings and thank you.

1 Answers1

0

I solve it by adding (string) like this:

(string)$HotelesDisponibles->Currency;

But if someone could explain me why this fixes the issue I would be happy.