|
Posted by Sonnich on 01/16/07 08:50
The following code is an exact copy of my current code.
The idea is to check 2 parts (of string arrays), and add those only
once to a common array.
I check for existance of an array in a string, as the string contain
more data that just .... well, the part from the options array is
there, then it is added to the folders array.
The problem is the line: if(!in_array($folders,
$options1[$k]))
which works in the first case, but not in the other, even that it is
copy-paste.
The entire things works as excepted, though I get the error:
Warning: in_array() [function.in-array]: Wrong datatype for second
argument in C:\Inetpub\wwwroot\some_file.php on line 754
The code follows
Sonnich
if($part9[$i]<>"")
{
$k=0;
while($k<count($options1))
{
if( (strpos($part9[$i], $options1[$k])!==false))
if(!in_array($folders, $options1[$k])) // here it works
$folders[]=$options1[$k];
$k++;
}
}
$j=0;
while(($j<count($Details0)) && ($Details0[$j]!=$part0[$i]) )
$j++;
while(($j<count($Details0)) && ($Details0[$j]==$part0[$i]) )
{
if($Details6[$j]<>"")
{
$k=0;
while($k<count($options1))
{
if( (strpos($Details6[$j], $options1[$k])!==false))
if(!in_array($folders, $options1[$k])) // here it does
not
$folders[]=$options1[$k];
$k++;
}
}
$j++;
}
Navigation:
[Reply to this message]
|