<?php
$peremennaya = file("array.txt");
for ( $x = 0; $x < count( $peremennaya ); $x++ ) {
$n = $x + 1;
list( $src, $h2 ) = explode( ' ', $peremennaya[$x] );
echo '
<div class="_30CWHKH _3eXsdaG" str="' . $n . '">
<div class="_1FmS6_e">
<img alt="Химия для бассейнов" src="' . $src . '" />
</div>
<a class="o0XE4_n" href="#">
<h2 class="_2PmikUJ" txt="' . $n . '">' . $h2 . '</h2>
<div data-dy="menu-item-tag"></div>
</a>
</div>
';
}