php - IF with string read by FGETCSV -


i have problemi in using if statement string read file through fgetcsv command. file start country (without quotes) in first position put if statement @ beginning of code in order verify file correct. if statement is:

if ($data[0]=="country") { … } else {  print $data[0]  } 

the if statement fails but... on screen see word country. means fgetcsv works well, there problems on string comparison. can tell me why if statement fails?

thanks in advance help

giorgio

try comparing this:

if (strtolower(trim($data[0])) == 'country') {   echo 'found'; } else {    print $data[0]  } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -