Jump to content

Archived

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

dsp77

Convert Loop Foreach Results to a Variable String

Recommended Posts

Hello, i have the code below and i need to have all results in a variable as a string, inside the loop they are displayed how i want but outside will echo the last result.  Thank You.

foreach($_POST as $key=>$value){
	if (is_numeric($value)) {
			$valoare = "$value,";

		}
}
echo $valoare;

Share this post


Link to post
Share on other sites

foreach($_POST as $key=>$value){

 

$valoare .= $value.",";

 

}

echo $valoare;

 

If uou mean they all join together as string.

Share this post


Link to post
Share on other sites

oh yes, that is so obvious hehe didn't cross my mind, thank you.

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.