1

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.

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.