Can somebody please help me to convert the following small piece of Perl to its PHP equivalent? It's for a content management system.
@pagetext = split( /<pr>/i, $text );
@pagetitle = ( $subject );
$pagetitle = $subject;
for( my $i = 1; $i < @pagetext; ++$i ) {
if( $pagetext[$i] =~ s~\A(.*)</pr>~~i ) {
$pagetitle = $1;
}
push( @pagetitle, $pagetitle );
}
$pagemax = scalar @pagetext;
$text is a block of text containing one or more instances of <pr>a page title goes here</pr>
$subject is the title of the first page of this article.
Basically, the result should be two arrays: pagetext, containing the text between <pr> tags, and pagetitle, the text between <pr> and </pr> tags.
I hope somebody can help. Thanks.