Browscap\Data\Expander::getVersionParts PHP Method

getVersionParts() public method

splits a version into the major and the minor version
public getVersionParts ( string $version ) : string[]
$version string
return string[]
    public function getVersionParts($version)
    {
        $dots = explode('.', $version, 2);
        $majorVer = $dots[0];
        $minorVer = isset($dots[1]) ? $dots[1] : 0;
        return [$majorVer, $minorVer];
    }

Usage Example

Example #1
0
 /**
  * tests setter and getter for the version parts
  *
  * @group data
  * @group sourcetest
  */
 public function testGetVersionParts()
 {
     $result = $this->object->getVersionParts(1);
     self::assertInternalType('array', $result);
     self::assertSame(array('1', 0), $result);
 }
All Usage Examples Of Browscap\Data\Expander::getVersionParts