PHP parsing file

Hi all,

I have a file with content in this format

Question 1
what is name of our planet

A. Pluto
B. Earth
C. Mars

Answer: B
blah blah blah
blah blah blah
blah blah blah
blah blah blah

Question 2
what is name of our country

A. USA
B. CANADA
C. Australia

Answer: A
blah blah blah
blah blah blah
blah blah blah
blah blah blah

Now i want to enter question, choices and answer to my database. But i dont know how to parse them, i mean what logic do i need to apply here.

I am using PHP and need to upload this stuff to a website, so if someone can help me with php code here i will be grateful

I did it :slight_smile:

I was having trouble writing the logic in php. So i first coded the program in python (took me 15 mins i guess), and then i ported it to php.

Clever huh :slight_smile:

Yes :smiley: