<?php $test = <<<TEST<p>First paragraph</p><p>Second paragraph</p><p>Third paragraph</p>TEST; preg_match('/(<p>)([^<]*)<\/p>$/', $test, $matches); var_dump($matches); ?>
Standard input is empty
array(3) { [0]=> string(22) "<p>Third paragraph</p>" [1]=> string(3) "<p>" [2]=> string(15) "Third paragraph" }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!