0 ; $i-- ) { // is numeric makes sure that the whole substring is a number if ( is_numeric( substr( $browser_user_agent, $start_pos, $i ) ) ) { $browser_number = substr( $browser_user_agent, $start_pos, $i ); break; } } return $browser_number; } /* sample: include('browser_detection.php'); $a_browser_data = browser_detection('full'); if ( $a_browser_data[0] !== 'ie' ) { execute the non msie conditions } else // if it is msie, that is { if ( $a_browser_data[1] >= 5 ) { execute the ie stuff } } */ ?>