The way I usually start to write a (big) program is in a text editor.
I just write down in my own words what needs to be done, and as I am writing it down, I begin to put in more and more details.
A first draft can look like:
Build a shoppingcart system.
and that could be it...
For example, if you start to build a shoppingcart system, don't go straight to putting in a product with 34 fields of info attached to it.
First see if you can add a number or a string and make that work.
Then make things more complicated as you go along.
Start with the big picture, and refine each part;
List products in a page.
Let user select products.
add products to user cart.
Then you can start to put the flow of things into a few small PHP statements:
if (products are available)
{
print page with products for user to select
}
(user makes selection, presses submit)
read data from user post
if (products have been selected)
{
check which products are selected and process them
}
It gets more and more detailed as you go along.
When you come to things like: (user makes selection) that is where you
would move to a new script that can process the data from the user.
After a while you'll see that you have a skeleton of a program and you can move the thing to PHP and start testing the flow of things for real.
that doesn't mean the program has top actually do anything, just see if you can get to where you want to go.
And most importantly, comment on everything you do.
Don't let a single IF or WHILE go by without a small description of what it does.