Jump to content

Possible Interpolation *SOLVED*


HuggieBear

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.

[code=php:0]
<?php
$fruit = $_GET['fruit'] // The value of 'fruit' is going to be a text string passed from a form of either "$apple" or "$grape"
$apple[]="red";
$apple[]="green";
$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;
}
?>
[/code]

I hope this made sense.

Regards
Rich
Link to comment
https://forums.phpfreaks.com/topic/19293-possible-interpolation-solved/
Share on other sites

Archived

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

×
×
  • Create New...

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.