<?php preg_match('/^[^.]*\.(?=\w+\.\w+$)/','subdomain.example.com',$matches); $subdomain = isset($matches[0]) ? trim($matches[0],'.') : ''; echo $subdomain;
You have javascript disabled. You will not be able to edit any code.