I want to use a column that contains the string encoded with base64_encode() function as primary key. But I couldn’t get to learn that if same string gets different values when encoded with base64_encode().
Should I check the key existence with using encoded string in sql queries or should I get all values from DB and decode them one by one to see if that key exist? That depends on knowing if base64_encode() function always creates the same output for given string. Does it?
Thanks in advance.
Yes, the function base64_encode() always produces the same output for a given string. This is called deterministic function or deterministic algorithm.
http://en.wikipedia.org/wiki/Deterministic_algorithm