将php值拆分为两部分

I want to split variable php value into two parts. Inside a script that I use I load variables using this code:

{$searchResults.domainName}

The value is always defined like "domain name.com"
I want to splits this into two values

Before and after the dot, so I can load the value "domain" and the value ".com"

How can I achieve that with php?

You can use PHP explode for that:

$pieces = explode(".", $domainName);

/

$pieces[0] outputs 'domain'

$pieces[1] outputs 'com'

PHP Explode Manual