Interview question

Hello, I received a question on the spot on a junior php position interview which sounds like this:
You have 2 dates: 28.08.2016 and 29.09.2015, stored in 6 variables like $a1=28, $a2=29; $a3=8;$a4=9 etc. I was asked to make the difference without using any date functions, nothing written, just to think and tell him how I would do it, so he can see how I think. And they way I said it was to turn it in days taking into account years%4==0 would be for 29 days February. So for months I would check both odd and even, skipping February, and on odd it would be 31 days, and on even it would be 30. He pointed out that july and august both have 31 days so I said from month 1-7 we do it like I said and from 8-12 even is 31 and odd is 30. Then he wished me luck and that was that with the interview, clearly he won’t call back but now I am wondering if my way of solving problem is that bad and that I won’t be a good programmer. Should I expect similar questions like that on interviews? Maybe even harder?

You tried. Even though the answer wasn’t what he was looking for, you did your best with what you had. This in no way means that you’re a bad programmer. Try working up a solution now that you have access to a web search. Also, do a search for something like “php interview questions” to get an idea of what you can expect.