I'm trying to compare two values in Codeigniter but the result is always false even if the values and type are same. I'm using this piece of code in CodeIgniter. Below code.
$return_name = $this->db->get('feegroup');
$data = $return_name->result();
foreach($data as $d)
{
$name = $d->name;
if(($name) === ($this->input->post("name")))
{
$this->session->set_flashdata('error_message',"Sorry cannot create $name fee group, you cannot have two similar fee groups. Either edit or delete $name fee group or change name to create a new fee group.");
redirect(base_url("feegroup/add"));
}#EOF IF
}#EOF foreach
I have used trim(), strlen(), is_string() to view the result it shows true everytime but while comparing same data it returns false.
If values from DB comes Sample and If users types sample it returns false but If values from DB comes Sample and If users type Sample it returns True It is not checking the Case.
For example:
1 Parent === Parent = True
2 Parent === parent = False
3 Parent === Sam = False
4 Sam === sam = False
5 heLLO === hello = False