tags:

views:

36

answers:

1

$content gives the html code like:

<p>text</p>
<p><img ... /></p>
<div class="video">...</div>

or just

<p>text</p>
<p>more text</p>

Also we have a variable:

$video_match = false;

We should turn $video_match to true, if <div class="video"> (exactly this code) exists in $content.

Thanks.

+5  A: 

Use:

if (strpos($content, '<div class="video">') !== FALSE)
{
  $video_match = true;
}

More Info:

Update:

Or more compact version as shown in the comments below:

$video_match = (strpos($content, '<div class="video">') !== FALSE);
Sarfraz
Simply this would do the job : $video_match = (strpos($content, '<div class="video">') !== FALSE);
HoLyVieR
`$video_match = (strpos($content, '<div class="video">') !== FALSE);`
You
@HoLyVieR: That's true but strictly it would return a number not true but anyway any number greater than 0 would still be considered true so yes that is a short way of doing it. Thanks
Sarfraz