I have a big list of PHP defines. I'm using it as a language file. I want to move language definations from that file to MySQL table. Is there some useful function that I could use?
Format in language file:
define("TXT_HELLO", "Hello!");
define("TXT_BYE", "Bye!");
Thanks in advance.
Yes, you can use get_defined_constants(), which will return you array with all defined constants.
Then, you can walkthrough that array using foreach
and insert them into your database.
Try:
print_r(get_defined_constants(true)); // true means the consts will be categorized