Note that there are some explanatory texts on larger screens.

plurals
  1. POWrap links round words php
    primarykey
    data
    text
    <p>Hello I would to wrap google search link tags round each of the foods to plant in a given month in this code block. But don't want to write out all the a href tags manually as I need to do a couple of blocks similar to this and it will be quite time consuming. Is there a way to get php to do this using something like preg_replace.</p> <pre><code> &lt;?php switch(date(n)) { case 1: echo "Garlic, Onion"; break; case 2: echo "Cabbage, Carrot, Garlic, Leek, Pea, Wheat"; break; case 3: echo "Cabbage, Carrot, Chives, Aubergine, Garlic, Leek, Lettuce, Pea, Rhubarb, Spinach, Tomato"; break; case 4: echo "Cabbage, Carrot, Chives, Cucumber, Aubergine, Garlic, Leek, Lettuce, Pea, Pumpkin, Rhubarb, Spinach, Tomato, courgette"; break; case 5: echo "Asparagus, Broad Beans, Cabbage, Carrot, Chives, Cucumber, Leek, Lettuce, Oregano, Pea, Pumpkin, Rhubarb, Spinach, Tomato, courgette"; break; case 6: echo "Asparagus, Broad Beans, Cabbage, Carrot, Cucumber, Kale, Lettuce, Oregano, Pea, Pumpkin, Rhubarb, Sage, Spinach, Tomato, courgette"; break; case 7: echo "Asparagus, Broad Beans, Broccoli, Brussel Sprouts, Cabbage, Carrot, Cauliflower, Cucumber, Kale, Oregano, Parsley, Rhubarb, Sage"; break; case 8: echo "Asparagus, Broccoli, Brussel Sprouts, Cabbage, Carrot, Cauliflower, Kale, Oregano, Parsley, Sage"; break; case 9: echo "Asparagus, Broccoli, Brussel Sprouts, Cabbage, Carrot, Cauliflower, Kale, Oregano, Parsley"; break; case 10: echo "Cabbage, Onion, Parsley"; break; case 11: echo "Apples, Garlic, Onion"; break; case 12: echo "Apples, Garlic, Onion"; break; }?&gt; </code></pre> <p>For example for december, case 12 I would like the line to be:</p> <pre><code>echo "&lt;a href='http://www.google.co.uk/search?q=Apples'&gt;Apples&lt;/a&gt;, &lt;a href='http://www.google.co.uk/search?q=Garlic'&gt;Garlic&lt;/a&gt;, &lt;a href='http://www.google.co.uk/search?q=Onion'&gt;Onion&lt;/a&gt;"; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload