Question: Hello So i have transparent picture 995x100px and a list of 1000 urls.
I want to make imagemap with all this urls.
I know how to do it by hand but the problem is i got 1000 urls so i want to generate
1000 random coordinates and put all the urls inside on the fly.

```
      <?php
      $urls = array("www.link1.com", "www.link2.com " ,      "www.link3.com","www.link4.com");
 shuffle($urls); // randomize the urls

    // start the image map
 $map =  <<<EOL
<img src="links.png" width="998" height="100" border="0" usemap="#mymap" />
<map name="mymap">

EOL;

$i = 0;
for ($y = 0; $y = $y + 10; $y < 100) {
for ($x = 0; $x = $x + 10; $x < 995) {
    $bot_x = $x + 9;
    $bot_y = $y + 9;
    $map .= <<<EOL
<area shape="rect" coords="{$x},{$y},{$bot_x},{$bot_y}" href="{$urls[$i]}" />

 EOL;
    $i++;
 }
}
 $map .= <<<EOL
 </map>

 EOL;

echo $map;

?>

```

Answer: 
Yes, encapsulate the code within the `"b"` case into a function/procedure and call it from case `"a"`
In that case, I you may want to make whatever "executeB" is into a private function and just call that.