Custom variables and membership in wordpress?

How to create and store custom variable? Is it similar to php variable and then store it in db?

or is there anything we have know?