Jump to content

[SOLVED] Function or Class for use making links. please help me


paulman888888

Recommended Posts

Hi;

 

1st of all thankyou for reading this.

 

I am trying to make a function that will keep looping lots of variables thats passed to it. Let me explain;

 

function make_link($a1,$a2, $b1,$b2, how do i make a loop that will get all passed to it? sometimes just 1 is passed and other times upto 20){

//now another loop

i think i will need to use foreach but dont know how

$returnme='index.php?';

foreach(somecode here not sure what){

 

$returnme.=$a1.'='$a2.'&';

}return $returnme;}

 

in more detail

each letter has 2 parts, 1 and 2

1=variable name

2=variable value

 

the reason i want to do this is incase i want to use .htaccess and it would be much easyier generate links than to go change them all myself.

 

 

Thankyou

Paul

 

function theLooper($vars)
{
if (is_array($vars))
	{
        foreach ($vars as $k => $v)
        	{
        	//do something	
        	}
	} 
else
	{
	echo "not an array of values";	
	}
}

theLooper(array("Name" => "Andrew","Age" => "20"));

Do you mean like that?

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.