Duff's device
[email protected] (Hartmut Holzgraefe)
| Newsgroups | php.lang |
|---|---|
| Organization | Six Offene Systeme GmbH |
| Message-ID | <[email protected]> |
Just wondering:
as PHP syntax is heavily based on C syntax i was curious if it
would accept this code snippet:
<?php
$to="";
$from="abcdefghijklmnopqrstuvwxyz";
$count=12;
$n = ($count + 7) / 8;
$i=0;
switch ($count % 8)
{
case 0: do { $to .= $from{$i++};
case 7: $to .= $from{$i++};
case 6: $to .= $from{$i++};
case 5: $to .= $from{$i++};
case 4: $to .= $from{$i++};
case 3: $to .= $from{$i++};
case 2: $to .= $from{$i++};
case 1: $to .= $from{$i++};
} while (--$n > 0);
}
echo $to;
?>
sure enugh it didn't although the C equvalent is indead legal
-> http://www.tuxedo.org/~esr/jargon/html/entry/Duff's-device.html
;)
--
Hartmut Holzgraefe [email protected] http://www.six.de +49-711-99091-77