Make two wood frames out of 2x4s crossed with 1x4s.
Attach a ledger board to the wall. This board will provide support for the bench top. Next, attach a wood cleat on either side of the ledger board. Hinges will be attached to these pieces.
Attach the frames to the cleats. The orientation of the hinges is important in order to make the unit fold flat. As you stand facing the unit, the two hinges closest to the wall should be placed on the right-hand side of each leg. The two hinges closest to you should be placed on the left-hand side of each leg (Image 1). This will allow the hinges to fold opposite of each other (Image 2) and allow the completed workbench to fold flat against the wall (Image 3).
Add a wood cleat to the front to stabilize the unit, attaching it to the hinges that were attached on the left side in step 2.
Make the top of the workbench using a piece of plywood. The dimensions of the top are based on the size of the base of the unit. Make sure the top clears the floor when folded down.
Measure in 6" from one of the long sides of the plywood top. Cut a groove deep and wide enough to accommodate a piano hinge.
Cut down the center of the groove, which creates a piano hinge. Use the piano hinge to re-attach the two pieces.
Re-connect the plywood top to the rest of the unit.
Build a frame around the edge of the top to finish the piece.