I´m dealing with Sabre/vobject. To read property values it is necessary to do a casting:
echo (string)$vcard->FN;
I forgot that a few times and observed that for example:
$number = str_replace("\xc2\xa0", "\x20", $card->TEL);
$name = strtoupper($card->FN);
still works.
The PHP manual says:
"...String conversion is automatically done in the scope of an expression where a string is needed. This happens when using the echo or print functions, or when a variable is compared to a string..."
However, I have found no reference to the fact that this also applies to string functions.
str_replace(), the third argument needs to be a string or an array. If you pass in something other than an array, it will try and convert it to string. In yourechoexample, you shouldn't need to convert it to string either, like the second sentence says.var_dump($vcard->FN);, what do you get? What type does the value have?str_replace(), since that's not the common behavior. The more info we get, the more likely it is for us to be able to reproduce the issue and answer the actual question.