note 102244 added to control-structures.switch

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
theimp at iinet dot net dot au :

How is that mess better than the sane way of doing it?

<?php
function flavor($type = null)
{
  $flavors = array('chocolate', 'strawberry', 'vanilla');
  if (in_array($type, $flavors)) {
    return "Flavor selected: $type";
  } else {
    return "Flavors available: " . implode(", ", $flavors);
  }
}
?>

I'm all for learning the ins and outs of the PHP interpreter, but you're trying to say that your abuse of the switch syntax will somehow cut down on code maintenance? How can that be, when your method requires copy-pasting code (always a red flag) and the normal way doesn't?
----
Server IP: 69.147.83.197
Probable Submitter: 12.239.150.194
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit        -- https://master.php.net/note/edit/102244
Del: integrated  -- https://master.php.net/note/delete/102244/integrated
Del: useless     -- https://master.php.net/note/delete/102244/useless
Del: bad code    -- https://master.php.net/note/delete/102244/bad+code
Del: spam        -- https://master.php.net/note/delete/102244/spam
Del: non-english -- https://master.php.net/note/delete/102244/non-english
Del: in docs     -- https://master.php.net/note/delete/102244/in+docs
Del: other reasons-- https://master.php.net/note/delete/102244
Reject      -- https://master.php.net/note/reject/102244
Search      -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.