Skip to content

Tag: for-loop

php for loop from array stops after 3 loops

I have an array that looks like this. I want to loop through array in the first key of [2] and echo all the values. this works, but stops after three loops and the output looks like this: I am expecting — hoping for this: I don’t understand why it is stopping. thanks. Answer Your problem lies here…

PHP getting days of a month for a database

I’m making a calender planner with php/css/javascript/html. I am trying to set each day of the month a class which is “day”. I tried using the following: It does not work correctly, it kept duplicating every month and I am not sure how to correctly right the php to achieve what was intended.…

Stuck with the number pattern printing in PHP

Stuck with the number pattern printing logic. Let me know what i am doing wrong as my file is simply going on execution without giving me a pattern. My Code — Pattern to achieve — UPDATE After applying new changes following are the screenshots — Answer Your error is in the last for, that sho…