onerror=string . $varible - fails
<p>Why it fails? It works when onerror=is not a varible but just a hadrtyped string.</p>

<pre><code>&lt;?php 
$error = "onerror='this.src = \'http://userlogos.org/files/logos/pek/stackoverflow2.png\'';";
for ($i = 1; $i &lt;= 10; $i++) { 
  echo "&lt;img src='http://services.runescape.com/m=itemdb_rs/3716_obj_sprite.gif?id=" . $i . "' alt='ID " . $i . "' title='ID " . $i . "'" . $error . "/&gt;"; 
} 
?&gt;
</code></pre>
