You don't need php for this. Use media queries and responsive design. This way you don't end up creating a separate mobile site. A grid design is useful for this e.g. 960gs.
diafol
Keep Smiling
10,644 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,508
Skill Endorsements: 57
Google 'responsive design media query'...
diafol
Keep Smiling
10,644 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,508
Skill Endorsements: 57