- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$s = '3.14';
$i = 1;
$numberRegex = '/-?(?:0|[1-9][0-9]*+)(?:\.[0-9]*+)?(?:[Ee][+-]?[0-9]+)?/A';
if ( preg_match( $numberRegex, $s, $matches, 0, --$i ) ) {
$i += strlen( $matches[0] );
var_dump( array( 's', $matches[0] - 0 ) );
}