Code: Alles auswählen
/**
* Ich habe bereits die Werte für Variablen nach vorheriger Prüfung in den Code
* eingesetzt, damit er etwas übersichtlicher ist
**/
if( preg_match(
'#(.*?)<!-- ELSE '.preg_quote('title').' -->(.*?)#s',
' <tr>
<th colspan="4">{title}</th>
</tr>
<!-- ELSE title -->
<tr>
<td colspan="4">TEST</td>
</tr>
',
$else_blocks) )
{
print_r($else_blocks);
}
Code: Alles auswählen
Array
(
[0] =>
<tr>
<th colspan="4">{title}</th>
</tr>
<!-- ELSE title -->
[1] =>
<tr>
<th colspan="4">{title}</th>
</tr>
[2] =>
)