Jun
11

As a continuation of the PEAR Manager Post, I’ve written this small code to retreive version from PEAR Package. I just parsed the header comment, I’ll try to finish an alpha version of the Pear Manager so we could open a discussion about it :-)

/**
* PearVersion : Return version of a PEAR package
*
* @param string $package The package name
* @param string $path Path to pear
* @author Hatem
* @return string $version
*/
function PearVersion($package,$path = “c:/php4/PEAR/”) {

$data = implode(”,@file($pear.$package.”.php”));

preg_match(”|$package(.php)?,v (.*) (.*)n|U”,$data,$matches);

$version = $matches[2];

return $version;
}

echo PearVersion(”PHPUnit”);


Update : Read The Pear Manager (Part 2) for a correct way to get a Pear Package version

Tags: No Tags

No Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>