if (0 == strcmp(trim($stringa1), trim($stringa2))){
//uguali
}else{
//diverse
}