- var_dump: documentation ( source)
- strpos: documentation ( source)
- is_numeric: documentation ( source)
<?php
$value = 'ver 1.0'; // string
if(is_numeric($value)) {
$value = (int)$value;
if(strpos($value, '.')) {
$value = (float)$value;
}
}
var_dump($value);