Jump to content


This topic is now archived and is closed to further replies.


Possible Interpolation *SOLVED*

Recommended Posts

I think this is an interpolation question but I'm not sure.

I have the following code, now I know the code's not ideal, but I'm putting it like this so I can learn.

$fruit = $_GET['fruit'] // The value of 'fruit' is going to be a text string passed from a form of either "$apple" or "$grape"
$grape[] = "purple";
$grape[] = "green";

foreach ($var as $colour){ // how can I make $var whatever the value of $fruit is I guess I need to interpolate the variable
  echo $colour;

I hope this made sense.


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.