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.

0

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.