Jump to content

html in IF statement


elfuser

Recommended Posts

I am trying to use a html tag in an if statement, but for some reason it is not working. can anybody give me some insight into what might be going on.

Thanks in advance for any help.

 

<html>
<?php
$lines = file('http://www.example.com');

$ta = htmlspecialchars('<body>');

foreach ($lines as $line_num => $line) 
{ 
echo "Is this ".htmlspecialchars($line)." the same as this ".$ta."?<br>";
if(htmlspecialchars($line) === $ta)
{
  echo "YES<br>";
}
else
{
echo "NOT<br>";
}
}

?>
</html>

Link to comment
https://forums.phpfreaks.com/topic/194575-html-in-if-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.