Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Replace Special Chars
    text
    copied!<p>I am running the below script and it gets the value of player from an XML Feed. If I run the code this way it replaces the é with an e,</p> <pre><code> $player = "Toré"; echo "Player Before: $player &lt;br /&gt;"; $playerafter = strtr($player, $normalizeChars); echo "Player After: $playerafter &lt;br /&gt;"; </code></pre> <p>But if I run it with the XML Feed it does not change</p> <pre><code> $player = "$event-&gt;player"; echo "Player Before: $player &lt;br /&gt;"; $playerafter = strtr($player, $normalizeChars); echo "Player After: $playerafter &lt;br /&gt;"; </code></pre> <p>Here is the variable $normalizeChars</p> <pre><code> $normalizeChars = array( 'Á'=&gt;'A', 'À'=&gt;'A', 'Â'=&gt;'A', 'Ã'=&gt;'A', 'Å'=&gt;'A', 'Ä'=&gt;'A', 'Æ'=&gt;'AE', 'Ç'=&gt;'C', 'É'=&gt;'E', 'È'=&gt;'E', 'Ê'=&gt;'E', 'Ë'=&gt;'E', 'Í'=&gt;'I', 'Ì'=&gt;'I', 'Î'=&gt;'I', 'Ï'=&gt;'I', 'Ð'=&gt;'Eth', 'Ñ'=&gt;'N', 'Ó'=&gt;'O', 'Ò'=&gt;'O', 'Ô'=&gt;'O', 'Õ'=&gt;'O', 'Ö'=&gt;'O', 'Ø'=&gt;'O', 'Ú'=&gt;'U', 'Ù'=&gt;'U', 'Û'=&gt;'U', 'Ü'=&gt;'U', 'Ý'=&gt;'Y', 'á'=&gt;'a', 'à'=&gt;'a', 'â'=&gt;'a', 'ã'=&gt;'a', 'å'=&gt;'a', 'ä'=&gt;'a', 'æ'=&gt;'ae', 'ç'=&gt;'c', 'é'=&gt;'e', 'è'=&gt;'e', 'ê'=&gt;'e', 'ë'=&gt;'e', 'í'=&gt;'i', 'ì'=&gt;'i', 'î'=&gt;'i', 'ï'=&gt;'i', 'ð'=&gt;'eth', 'ñ'=&gt;'n', 'ó'=&gt;'o', 'ò'=&gt;'o', 'ô'=&gt;'o', 'õ'=&gt;'o', 'ö'=&gt;'o', 'ø'=&gt;'o', 'ú'=&gt;'u', 'ù'=&gt;'u', 'û'=&gt;'u', 'ü'=&gt;'u', 'ý'=&gt;'y', 'ß'=&gt;'sz', 'þ'=&gt;'thorn', 'ÿ'=&gt;'y' ); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload