PHP Code Sample: Display CVS Tag

Ever wonder how to get a revision number of a file or other CVS tags to appear on PHP pages? I did and here’s what I came up with:

$revision = "$Revision: 1.111 $";
$revision = trim($revision, "$");
$revision = "File version$revision";

The “1.111″ will be changed by CVS to whatever the revision is. I have seen a lot of open source type projects that display this information with the question marks. That always bugged me. Anyway, to display this just echo the variable wherever you need.

This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to PHP Code Sample: Display CVS Tag