Cześć!
Chciałabym za pomocą wyrażenia regularnego wyświetlić zawartość tabeli(wartosc1, wartosc2...).
Bardzo proszę o pomoc.
Mam taki kod:
<?php $content = '
<table>
<thead>
<tr>
<th tabindex="0">kolumna1</th>
<th tabindex="0">kolumna2</th>
<th tabindex="0">kolumna3</th>
</tr>
</thead>
<tbody>
<tr>
<td tabindex="0">wartosc1</td>
<td tabindex="0">wartosc1</td>
<td tabindex="0">wartosc1</td>
</tr>
<tr>
<td tabindex="0">wartosc2</td>
<td tabindex="0">wartosc2</td>
<td tabindex="0">wartosc2</td>
</tr>
</tbody>
</table>';
$classNames = ['<td tabindex="0">'];
$matches = [];
foreach( $classNames as $className ) {
$pattern = sprintf('(.*?)', $className);
preg_match("/{$pattern}/i", $content, $found);
$matches[] = $found;
}
var_dump($found);
?>