H
H
Httdientee2021-08-07 00:31:07
PHP
Httdientee, 2021-08-07 00:31:07

How to split information into lines in php?

"тел.: 044 451 75 18тел./факс: 044 451 89 18e-mail: [email protected]сайт: http://emkosti.kiev.ua,  http://giroulovitel.com.ua/"


I need to split this line so that they are separate + words tel: fax: e-mail: site: it shouldn't be, I tried something with explode, it doesn't really work, can someone help me solve this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Ordinary, 2021-08-07
@evgeniy8086

You can try regular expressions.
For example, pull out the phone like this

$matches = new Array();
preg_match( '#тел\.\:\s*([\d\s]+)#ui', $str, $matches );
The $matches[1] element will be equal to '044 451 75 18'
$matches = new Array();
preg_match( '#e\-mail\:\s*([\w\-\.\@]+)#ui', $str, $matches );
The $matches[1] element will be equal to '[email protected]'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question