Only 'test' is ever output, I know its something to do with the if loop but can't put my finger on the root cause, basically the string is input and exploded and each value is checked against the $permittedPlatf orms and if it is allowed then is is returned.
The input is: test,test2,blue
The input is: test,test2,blue
Code:
private function processPlatform($platformsIn) {
$permittedPlatforms = array('test','test2','blue');
$platforms = '';
$permittedSize = sizeof($permittedPlatforms);
$size = 0;
$count = 0;
$permittedCount = 0;
$platformsIn = explode(",",$platformsIn);
$size = sizeof($platformsIn);
while($count < $size) {
while($permittedCount < $permittedSize) {
if($permittedPlatforms[$permittedCount] == $platformsIn[$count]) {
if($platforms != '')
$platforms .= ', '.$platformsIn[$count];
else
$platforms .= $platformsIn[$count];
}
$permittedCount++;
}
$count++;
}
return $platforms;
}
Comment