<?php
    $date 
= new DateTime'2010-01-31 15:48:21' );
    echo 
$date->modify'last day of third month' )->format'Y-m-d' ), "\n";
?>
Output
2010-04-30

Explanation:
2010-01-31 15:48:21
2010-04-31 15:48:21 "third month" increases month number by 3
2010-05-00 15:48:21 "last day of" resets the day number to 0 and increases the month number by 1
2010-04-30 15:48:21 Day count is less than 1, so the algorithm corrects this to a proper date