title: "Parse error: Invalid numeric literal" php chr 039
body: <p>I am trying to convert a weird single speech mark to a normal one in php.</p>
  
  <pre><code>$str = str_replace(chr(039), "'", $str);
  </code></pre>
  
  <p>I have found it is code 039 from many sources including <a href="https://www.atwebresults.com/ascii-codes.php?type=2" rel="nofollow noreferrer">https://www.atwebresults.com/ascii-codes.php?type=2</a>.</p>
  
  <p>But it causes the "Parse error: Invalid numeric literal" error.</p>
  
  <p>My whole function:</p>
  
  <pre><code>function sanitiseString($str){
  
  $str = str_replace(chr(130), ',', $str);    // baseline single quote
  $str = str_replace(chr(132), '"', $str);    // baseline double quote
  $str = str_replace(chr(133), '...', $str);  // ellipsis
  $str = str_replace(chr(039), "'", $str);    // left single quote                
  
  $str = str_replace(chr(145), "'", $str);    // left single quote
  $str = str_replace(chr(146), "'", $str);    // right single quote
  $str = str_replace(chr(147), '-', $str);    // double hyphon        
  $str = str_replace(chr(150), '-', $str);    // en dash  
  $str = str_replace(chr(151), '-', $str);    // em dash  
  $str = str_replace(chr(148), '"', $str);    // right double quote                               
  $str = str_replace(chr(034), '"', $str);    // weird double speech mark
  $str = str_replace(chr(034), '"', $str);    // weird double speech mark
  
  $str = iconv("UTF-8","UTF-8//IGNORE",$str); //ignore everything else unrecognised.
  
  $str = str_replace("’", "'", $str);  
  $str = str_replace('“', '"', $str);  
  $str = str_replace('”', '"', $str);  
  
  return $str;        
  }
  </code></pre>