Jump to content

if comparison isn't identifing an string inside an array


brosjr

Recommended Posts

Hi everyone;

 

The point is, I have a string to break, it contains data and a simple code (//&//) that is exploded to generate an array of values, like:

 

M//&// Neves//&//salas 1 a 6//&// //&// Manual//&// //&// 70165900//&// Bras//&// Text

 

Than I get the $explodedarray:

 

Array ( [0] => M [1] => Neves [2] => salas 1 a 6 [3] => [4] => Manual [5] => [6] => 70165900 [7] => Bras [8] => Text)

 

The problem is, a simple if comparison is not working:

 

if($explodedarray[0] == 'M'){
echo 'yes';
}else{
echo 'no';
}

 

It returns 'no'. Even if I try another comparison like:

 

if($explodedarray[5] == ''){
echo 'yes';
}else{
echo 'no';
}

 

It also returns 'no'.

 

Any idea?

Thankx

Danilo Jr.

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.