Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I ignore "XXX" titles in my data parsing script?
    primarykey
    data
    text
    <p>I've tried and it doesn't seem to work. Any help would be greatly appreciated.</p> <p>CODE: </p> <pre><code>foreach (glob('mov/Alene*.mov') as $filename){ $theData = file_get_contents($filename) or die("Unable to retrieve file data"); } $string = $theData; $titles = explode("\n", $string); function getInfo($string){ $Ratings = ['G', 'PG', 'PG-13', 'R', 'NR', 'XXX']; $split = preg_split("/\"(.+)\"/", $string, 0, PREG_SPLIT_DELIM_CAPTURE); if(count($split) == 3){ preg_match("/(".implode("|", $Ratings).")\s/", $split[0], $matches); $rating = $matches[0]; return ["title" =&gt; $split[1], "rating" =&gt; $rating]; } return false; } $infolist = array(); foreach($titles as $title){ $info = getInfo($title); if($info !== false){ $infolist[] = $info; } } usort($infolist, "infosort"); function infosort($lhs,$rhs) { return strcmp($lhs['rating'], $rhs['rating']); } foreach ($infolist as $info) { echo "&lt;div style ='margin-bottom: 3px; text-align: center; font:13px Verdana,tahoma,sans-serif;color:green;'&gt; {$info["title"]} : {$info["rating"]}&lt;/div&gt;"; } //------------------LOGO---------------------// echo "&lt;div style='text-align:center; margin-top: 20px;'&gt;&lt;img src='imgs/shclogo.png' alt='Logo' width='200' height='133'/&gt;&lt;/div&gt;"; //-------------------------------------------// ?&gt; </code></pre> <p>I've tried adding:</p> <pre><code>if($info["rating"]!=="XXX")//foreach $infolist as $info... </code></pre> <p>I've also tried adding that in the source where preg_match is but that didn't work either. It all still displays the "XXX" titles.</p> <p>I just need to figure out how to ignore the XXX titles and display everything else.</p> <p>The output originally looks like this...</p> <pre><code>(HD) Safe House : R (HD) Wanderlust : R (HD) Machine Gun Preacher : R (HD) Silent House : R (HD) Seeking Justice : R Adult title 1 : XXX Adult title 2 : XXX Adult title 3 : XXX Adult title 4 : XXX </code></pre> <p>There are many more XXX titles, but I can't display them all. Any help and you'd be my life saver. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload