evtl.
down noch mal einklammern? *hrm*
Edit: Nee, das ist Blödsinn... aber dashier:
Code:
<pre>
<?php
$tests = array('status:up@ppX','status:waiting@ppX','status:down');
foreach ($tests as $test)
{
preg_match('=^(status):((.*?)@(.+)|down)$=',$test,$matches);
if (count($matches) < 4) {
$matches[3] = $matches[2];
$matches[4] = "none";
}
print_r($matches);
print "\n";
}
?>
</pre>
bringt das hier:
Code:
Array
(
[0] => status:up@ppX
[1] => status
[2] => up@ppX
[3] => up
[4] => ppX
)
Array
(
[0] => status:waiting@ppX
[1] => status
[2] => waiting@ppX
[3] => waiting
[4] => ppX
)
Array
(
[0] => status:down
[1] => status
[2] => down
[3] => down
[4] => none
)