How To Get Subversion Revision ID From PHP
First of all identify the file(s) for which you want to know the revision number from PHP. Then add a property to the file as follows:
svn propset svn:keywords Revision file_name.php
Now add the following function within php blocks:
/** Returns revision number */
function getSCID() {
$svnid = '$Rev: 43 $';
$scid = substr($svnid, 6);
return intval(substr($scid, 0, strlen($scid) - 2));
}
You can now access the revision number of this file from PHP by calling getSCID(). It returns an integer.
Note: Revision numbers are essential in writing upgrade scripts
Filed under Headline News, Open Source Software, PHP, Technology |
|
RSS 2.0 |
Trackback this Article
|
Email this Article
You may also like to read |


Add to Technorati Favorites


































July 8th, 2008 at 12:24 am
Does this only work when you have actual access to the SVN or could you use this to check the revision number when you have anonymous access?
July 9th, 2008 at 9:37 am
You can use this to check revision number even when you have anonymous access to the subversion repository.