Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>on your second preg_replace why there is a <code>\</code></p> <pre><code>preg_replace('/x([a-fA-F0-9]{2})/', '&amp;#$1;', $name); </code></pre> <p>ok I think there is some confusion here. you regular expression is matching something like <code>x66</code> and would replace that by '&amp;#66', which seems to be some <code>html entities</code> encoding to me but you are using <code>utf8_encode</code> which do that (from manual):</p> <blockquote> <p>utf8_encode — Encodes an ISO-8859-1 string to UTF-8 </p> </blockquote> <p>so the things would never get converted ... (or to be more precise the '&amp;#66' would remains '&amp;#66' since they are all same characters in ISO-8859-1 and UTF-8)</p> <p>also to be noted on your first snippet you use <code>\xC6</code> but this would never get caught by the <code>preg_replace</code> since it's already encoded character. The <code>\x</code> means the next hex number (0x00 ~ 0xFF) would be drop in the string as is. it won't make a string <code>xC6</code></p> <p>So I am kind of confused of what you really wanna do. what the preg_replace is all about? </p> <p>if you want to convert HTML entities to UTF-8 look into <code>mb_convert_encoding</code> (<a href="http://us.php.net/mb_convert_encoding" rel="nofollow noreferrer">manual</a>), if you want to do the reverse, code in HTML entities from some UTF-8 look into <code>htmlentities</code> (<a href="http://us.php.net/htmlentities" rel="nofollow noreferrer">manual</a>)</p> <p>and if it has nothing to do with all of that and you want to simply change encoding <code>mb_convert_encoding</code> is still there. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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