Jump to content

in_array help


devWhiz

Recommended Posts

<?php

$text_array = array('apple', 'peach', 'pear', 'orange');
$blacklist = "fruitblacklist.txt";
$blacklistarray = file($blacklist);
for($x=0; $x!=count($text_array); $x++)
{
if(in_array($text_array[$x], $blacklistarray)) continue;
echo $text_array[$x]."</br>";
}

?>

 

in the blacklist file, if I just have

 

apple

 

it outputs

 

peach
pear
orange

 

but when I add more than one like

 

apple
peach

 

it outputs

 

apple
pear
orange

 

why is it only reading one of the array values? I want it to skip each fruit that is in the array,

 

using fruit as an example :P any help is appreciated. thanks

Link to comment
https://forums.phpfreaks.com/topic/238747-in_array-help/
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.