解決策A:
<?php
$all = <<< STOPTHISCRAZYTHING
echo "<br><br><textarea rows=\"30\" cols = \"100\">";
echo "<div align=\"center\"><font size=\"7\">I Have</font></div>";
foreach($same as $match)
{
echo "<img src=\"" . $match . "\">";
}
echo "<div align=\"center\"><font size=\"7\">I Need</font></div>";
foreach($different as $diff)
{
if(!in_array($diff, $reject))
{
echo "<img src=\"" . $diff . "\">";
}
}
echo "<div align=\"center\"><font size=\"7\">I Am Unable To Obtain</font></div>";
foreach($retired_different as $unabletoget)
{
echo "<img src=\"" . $unabletoget . "\">";
}
echo "</textarea>";
STOPTHISCRAZYTHING;
echo $all;
?>
解決策B (使用htmlentities
):
<?php
$all = <<< STOPTHISCRAZYTHING
echo "<br><br><textarea rows=\"30\" cols = \"100\">";
echo "<div align=\"center\"><font size=\"7\">I Have</font></div>";
foreach($same as $match)
{
echo "<img src=\"" . $match . "\">";
}
echo "<div align=\"center\"><font size=\"7\">I Need</font></div>";
foreach($different as $diff)
{
if(!in_array($diff, $reject))
{
echo "<img src=\"" . $diff . "\">";
}
}
echo "<div align=\"center\"><font size=\"7\">I Am Unable To Obtain</font></div>";
foreach($retired_different as $unabletoget)
{
echo "<img src=\"" . $unabletoget . "\">";
}
echo "</textarea>";
STOPTHISCRAZYTHING;
echo htmlentities($all);
?>
ソリューションC ( ...タグでラップ<pre>
</pre>
) :
<?php
$all = <<< STOPTHISCRAZYTHING
<pre>
echo "<br><br><textarea rows=\"30\" cols = \"100\">";
echo "<div align=\"center\"><font size=\"7\">I Have</font></div>";
foreach($same as $match)
{
echo "<img src=\"" . $match . "\">";
}
echo "<div align=\"center\"><font size=\"7\">I Need</font></div>";
foreach($different as $diff)
{
if(!in_array($diff, $reject))
{
echo "<img src=\"" . $diff . "\">";
}
}
echo "<div align=\"center\"><font size=\"7\">I Am Unable To Obtain</font></div>";
foreach($retired_different as $unabletoget)
{
echo "<img src=\"" . $unabletoget . "\">";
}
echo "</textarea></pre>";
STOPTHISCRAZYTHING;
echo $all;
?>