I want to create a multi-image collage poster like this one:
Anybody know how to program it in php?
There are lots of examples and tutorials about combining multiple images into one using GD or ImageMagick.
The image libraries offer you the ability to create, copy, resize, rotate, and manipulate image data; however they don't just automagically know what sort of a montage you want. You have to define your criteria and think about how to go about instructing a program to arrange the photos how you want.
I ask all these questions as examples of things you need to define for your program. (And also to clarify your thoughts when asking others for help.)
If you're learning the image library functions, you should start with a simple task: take two images and combine them into one. You have to at least do this before you can hope to add the sort of complexity that would go into generating mosaics like the one you cited as an example.