Skip to content

Instantly share code, notes, and snippets.

@mgng
Created March 19, 2012 01:36
Show Gist options
  • Save mgng/2089540 to your computer and use it in GitHub Desktop.
Save mgng/2089540 to your computer and use it in GitHub Desktop.
PHP互換性調査。changelogから Upgraded、Updated、Added、Change、Removed、Allowed あたりを抜き取る。
<?php
$log = file( 'http://php.net/ChangeLog-5.php' ) or die( 'error' );
$buf = array();
foreach ( $log as $line ) {
$tmp = trim( $line );
if ( preg_match( '/^<h3>Version\s+\d.+?<\/h3>/i', $tmp ) ) {
$buf[] = "\n--------" . trim( strip_tags( $line ) );
}
if ( preg_match( '/^<li>(Upgraded|Updated|Added|Change|Removed|Allowed).+/i', $tmp ) === 1 ) {
$buf[] = trim( strip_tags( $line ) );
}
}
echo "via: http://php.net/ChangeLog-5.php\n\n", implode( "\n", $buf );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment