If-Abfrage in For-Schleife

poelchen1337

Mitglied
Hallo euch allen!

Ich komme mit einer if-Abfrage nicht zu recht!




Erklärung:
$founds ist ein array aus welchen die variable $einzel entsteht
in $art steht zB.: "Traditional Cache"


Hier mein Code Schnippsel:

Code:
foreach($founds as $einzel)
{


$xstop = strpos($einzel,'e');
$x = substr($einzel, 0, $xstop);
$y = substr($einzel, $xstop+1, 3);
$artstart = strpos($einzel,'!');
$artstop = strpos($einzel,'?');
$art = substr($einzel, $artstart+1, $artstop-$artstart-1);

echo "orig ".$art."<br>";
if($art=="Traditional Cache")
{ 
echo "das ist ein ".$art."<br><br>";
}






}




die If-Afrage wird nicht bei einem positiven Fall ausgelöst...
und drum frage ich Euch, wieso..

Nette Grüße aus Stuttgart
Robert;)
 
das mit den array das hat schon wochenlang funktioniert.. ich hab nur ein argument hinzugefügt..

Code:
echo "<input type='hidden' name='founds[]' value='".$xpix."e".$ypix."!".$type."?'>";

abgesehn davon werden alle werte ja schon aufegelöst..
und die ausgabe
aus

Code:
 echo "orig ".$art."<br>";
ist

Code:
 orig
orig Virtual Cache
orig Virtual Cache
orig Webcam Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Webcam Cache
orig Virtual Cache
orig Webcam Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Webcam Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Earthcache
orig Multi-cache
orig Traditional Cache
orig Webcam Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Multi-cache
orig Unknown Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Multi-cache
orig Multi-cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Multi-cache
orig Multi-cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Unknown Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Unknown Cache
orig Multi-cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Multi-cache
orig Traditional Cache
orig Unknown Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache
orig Traditional Cache  
..................
 
ich sehe
Code:
 string(0) "" string(35) " Virtual Cache" string(35) " Virtual Cache" string(34) " Webcam Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(34) " Webcam Cache" string(35) " Virtual Cache" string(34) " Webcam Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(34) " Webcam Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(33) " Multi-cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(35) " Unknown Cache" string(39) " Traditional Cache" string(32) " Earthcache" string(33) " Multi-cache" string(39) " Traditional Cache" string(34) " Webcam Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(35) " Unknown Cache" string(39) " Traditional Cache" string(33) " Multi-cache" string(35) " Unknown Cache" string(33) " Multi-cache" string(39) " Traditional Cache" string(39) " Traditional Cache" string(39) " Traditional Cache" strin

also ist doch ein Leerzeichen drin...WOW
jetzt nur noch was prüfen und Leerzeichen entfernen....
 
ich sehe diesen fehler, dafür ein nettes Danke!

aber bei:

Code:
$art = trim($art); 

echo $art."<br>"; 

if($art=="Traditional Cache") 
{ 
echo "das ist ein ".$art."<br><br>"; 
}

erhalte ich
Code:
Virtual Cache
Virtual Cache
Webcam Cache
Traditional Cache
Traditional Cache
Traditional Cache
Traditional Cache
Webcam Cache
Virtual Cache
usw....

leider funktioniert auch nicht..
 
bei:
Code:
 $artstart = strpos($einzel,'!');
$artstop = strpos($einzel,'?');
$art = substr($einzel, $artstart+1, $artstop-$artstart-1);

$art = trim($art); 
var_dump($art);
echo $art."<br>"; 

if($art=="Traditional Cache") 
{ 
echo "das ist ein ".$art."<br><br>"; 
}

das darf doch nichts ausmachen dass ich in einer FOR schleife bin oder ?

Code:
string(31) "Virtual Cache" Virtual Cache
string(31) "Virtual Cache" Virtual Cache
string(30) "Webcam Cache" Webcam Cache
string(35) "Traditional Cache" Traditional Cache
string(35) "Traditional Cache" Traditional Cache
string(35) "Traditional Cache" Traditional Cache
string(35) "Traditional Cache" Traditional Cache
string(30) "Webcam Cache" Webcam Cache
string(31) "Virtual Cache" Virtual Cache
string(30) "Webcam Cache" Webcam Cache
string(35) "Traditional Cache" Traditional Cache
 
Das leerzeichen dazweischen oder sonstwas scheint komisch zu sein
string(35) "Traditional Cache"
Also 35 Zeichen. Wenn ich aber nachzähle komme ich auf 17 Zeichen. Irgendwo stecken da noch 18 unsichtbare Zeichen dazwieschen

PHP:
var_dump("Traditional Cache");
// -> string(17) "Traditional Cache"
 
Zurück