Answer the question
In order to leave comments, you need to log in
Collect an array from a string - PHP?
They gave me a task.
There is a line containing this.
<h3></h3>
<dl class="data">
<dt class="name">Поле1</dt>
<dd class="value">Поле1_1</dd>
<dt class="name">Поле2</dt>
<dd class="value">Поле2_2</dd>
</dl>
$array = array(
array(
"name" => "Поле1",
"value" => "Поле1_1",
),
array(
"name" => "Поле2",
"value" => "Поле2_2",
)
);
Answer the question
In order to leave comments, you need to log in
Use the regular expression
https://regex101.com/r/WG5LYZ/1/
And process the result in the format you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question