- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$testString = '2.1.0';
preg_match('/(\d\.?)+/', $testString, $testResult1);
preg_match('/\d.\d.\d/', $testString, $testResult2);
var_dump($testResult1);
var_dump($testResult2);